public class GoldModel extends GameModel
Initially 20 gold coins are randomly placed in the matrix. The red gold collector aims to collect these coins which disappear after collection. Each coin is randomly moved to a new position every n moves, where n is the number of remaining coins. The game is won when all coins are collected and lost when collector leaves game board.
Modifier and Type | Class and Description |
---|---|
static class |
GoldModel.Directions |
Constructor and Description |
---|
GoldModel()
Create a new model for the gold game.
|
Modifier and Type | Method and Description |
---|---|
void |
gameUpdate(int lastKey)
This method is called repeatedly so that the
game can update its state.
|
getGameboardSize, getGameboardState, getGameboardState, setGameboardState, setGameboardState
public void gameUpdate(int lastKey) throws GameOverException
gameUpdate
in class GameModel
lastKey
- The most recent keystroke.GameOverException