lab1
Class GoldModel
java.lang.Object
lab1.GameModel
lab1.GoldModel
public class GoldModel
- extends GameModel
Sample game for illustration. Intentionally stupid; more interesting
games to be provided by students.
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.
Constructor Summary |
GoldModel()
Create a new model for the gold game. |
Method Summary |
void |
gameUpdate(int lastKey)
This method is called repeatedly so that the
game can update its state. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GoldModel
public GoldModel()
- Create a new model for the gold game.
gameUpdate
public void gameUpdate(int lastKey)
throws GameOverException
- This method is called repeatedly so that the
game can update its state.
- Specified by:
gameUpdate
in class GameModel
- Parameters:
lastKey
- The most recent keystroke.
- Throws:
GameOverException