|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.game.AbstractGame
com.antelmann.game.mine.MineSweeper
public class MineSweeper
An implementation of the game Mine Sweeper
| Constructor Summary | |
|---|---|
MineSweeper()
calls this(30, 16, 99, System.currentTimeMillis()) |
|
MineSweeper(int width,
int height,
int numberOfMines,
long randomSeed)
|
|
MineSweeper(int width,
int height,
int numberOfMines,
Random random)
|
|
| Method Summary | |
|---|---|
Object |
clone()
Any inheriting class with non-primitive members must override this clone() method to provide a full deep copy of the object, which is essential for spawnChild() to work correctly. |
boolean |
equals(Object obj)
|
int |
getHeight()
|
int |
getWidth()
|
int[] |
getWinner()
getWinner() returns an array of all winning game roles - as there could be more than one winner. |
int |
hashCode()
|
boolean |
isOpen(int column,
int row)
|
protected GameMove[] |
listLegalMoves()
listLegalMoves() returns the legal moves for this game. |
int |
nextPlayer()
nextPlayer() returns the integer representing the game role of the next player. |
protected boolean |
popMove()
always returns false |
protected boolean |
pushMove(GameMove move)
pushMove takes a GameMove and alters the game according to to the move. |
String |
toString()
overridden to provide useful information about the game |
| Methods inherited from class com.antelmann.game.AbstractGame |
|---|
addObserver, clearRedoList, gameOver, getGameName, getLastMove, getLastPlayer, getLegalMoves, getLegalMoves, getMoveHistory, getNumberOfRedoMoves, getObservers, getRedoList, getResult, isLegalMove, isWinner, loadFromFile, makeMove, numberOfMoves, numberOfPlayers, redoMove, removeObserver, resetLegalMoves, resetLists, saveToFile, spawnChild, undoLastMove, undoMoves |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MineSweeper()
this(30, 16, 99, System.currentTimeMillis())
public MineSweeper(int width,
int height,
int numberOfMines,
long randomSeed)
public MineSweeper(int width,
int height,
int numberOfMines,
Random random)
| Method Detail |
|---|
public Object clone()
throws CloneNotSupportedException
AbstractGamespawnChild() to work correctly. Ay overriding
of this method should still begin with a call to
super.clone(), though.
Also, note that this clone() method does not clone the
embedded GameMove objects, i.e. those are expected not to change
(except for their heuristics, which shouldn't affect game
functionality) - or the subclass will have to take care of this.
clone in interface GamePlayclone in class AbstractGameCloneNotSupportedExceptionAbstractGame.spawnChild(GameMove)public boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Objectprotected GameMove[] listLegalMoves()
AbstractGame
listLegalMoves in class AbstractGameprotected boolean pushMove(GameMove move)
AbstractGame
pushMove in class AbstractGameprotected boolean popMove()
popMove in class AbstractGamepublic int nextPlayer()
GamePlay
public int[] getWinner()
GamePlay
public int getWidth()
public int getHeight()
public boolean isOpen(int column,
int row)
public String toString()
AbstractGame
toString in class AbstractGame
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||