|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jscience.computing.game.AbstractGame
org.jscience.computing.game.fourwins.FourWinsGame
public class FourWinsGame
FourWinsGame represents the game of 4-wins or 4-connects. (other names for the game: four wins, connect four, vier gewinnt)
Field Summary | |
---|---|
protected int[][] |
board
DOCUMENT ME! |
int |
boardHeight
DOCUMENT ME! |
int |
boardWidth
DOCUMENT ME! |
int |
MAX_MOVES
DOCUMENT ME! |
static int |
WINNING_LINE_LENGTH
DOCUMENT ME! |
Constructor Summary | |
---|---|
FourWinsGame()
creates the standard game board with 7x6 |
|
FourWinsGame(java.lang.String name)
Creates a new FourWinsGame object. |
|
FourWinsGame(java.lang.String name,
int width,
int height)
Creates a new FourWinsGame object. |
Method Summary | |
---|---|
protected int |
checkPositionWin(int column,
int row)
DOCUMENT ME! |
java.lang.Object |
clone()
DOCUMENT ME! |
boolean |
equals(java.lang.Object obj)
DOCUMENT ME! |
protected int |
freePositionInColumn(int column)
DOCUMENT ME! |
int |
getHeight()
DOCUMENT ME! |
int |
getValueAt(int column,
int row)
Returns the value for a specified position in the game board. |
int |
getWidth()
DOCUMENT ME! |
int[] |
getWinner()
DOCUMENT ME! |
int |
hashCode()
experimental, but working |
protected GameMove[] |
listLegalMoves()
DOCUMENT ME! |
int |
nextPlayer()
DOCUMENT ME! |
protected boolean |
popMove()
DOCUMENT ME! |
protected boolean |
pushMove(GameMove move)
DOCUMENT ME! |
java.lang.String |
toString()
DOCUMENT ME! |
Methods inherited from class org.jscience.computing.game.AbstractGame |
---|
clearRedoList, gameOver, getGameName, getLastMove, getLastPlayer, getLegalMoves, getLegalMoves, getMoveHistory, getNumberOfRedoMoves, getRedoList, getResult, isLegalMove, isWinner, loadFromFile, makeMove, numberOfMoves, numberOfPlayers, redoMove, resetLegalMoves, resetLists, saveToFile, spawnChild, undoLastMove, undoMoves |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int WINNING_LINE_LENGTH
public final int MAX_MOVES
public final int boardWidth
public final int boardHeight
protected int[][] board
Constructor Detail |
---|
public FourWinsGame()
public FourWinsGame(java.lang.String name)
name
- DOCUMENT ME!public FourWinsGame(java.lang.String name, int width, int height) throws java.lang.IllegalArgumentException
name
- DOCUMENT ME!width
- DOCUMENT ME!height
- DOCUMENT ME!
java.lang.IllegalArgumentException
- DOCUMENT ME!Method Detail |
---|
protected GameMove[] listLegalMoves()
listLegalMoves
in class AbstractGame
public int nextPlayer()
protected boolean popMove()
popMove
in class AbstractGame
protected boolean pushMove(GameMove move)
pushMove
in class AbstractGame
move
- DOCUMENT ME!
public int[] getWinner()
public int getValueAt(int column, int row) throws java.lang.ArrayIndexOutOfBoundsException
column
- DOCUMENT ME!row
- DOCUMENT ME!
java.lang.ArrayIndexOutOfBoundsException
- DOCUMENT ME!protected int freePositionInColumn(int column) throws java.lang.IllegalArgumentException
column
- DOCUMENT ME!
java.lang.IllegalArgumentException
- DOCUMENT ME!protected int checkPositionWin(int column, int row)
column
- DOCUMENT ME!row
- DOCUMENT ME!
public int getWidth()
public int getHeight()
public java.lang.String toString()
toString
in class AbstractGame
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in interface GamePlay
clone
in class AbstractGame
java.lang.CloneNotSupportedException
- DOCUMENT ME!AbstractGame.spawnChild(GameMove)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- DOCUMENT ME!
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |