|
|||||||||
| 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.tictactoe.TickTackToe
public class TickTackToe
This class implements the game TickTackToe. The board positions are
represented as follows:
0 1 23 4 56 7 8
| Constructor Summary | |
|---|---|
TickTackToe()
Creates a new TickTackToe object. |
|
TickTackToe(java.lang.String name)
Creates a new TickTackToe object. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
making sure that the internal non-primitive board representation is properly cloned to allow the deep-copy required for spawnChild() |
boolean |
equals(java.lang.Object obj)
required to allow recognizing the same game status even after serialization (to support network games, GameBooks, etc.). |
int[] |
getWinner()
getWinner() is checking for a triple (three-in-a-row). |
int |
hashCode()
It's just some number derived from a portion of the board; not guaranteed to be unique for every game, but guaranteed to always be the same for the same board. |
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 |
| Constructor Detail |
|---|
public TickTackToe()
public TickTackToe(java.lang.String name)
name - DOCUMENT ME!| Method Detail |
|---|
public int nextPlayer()
public int[] getWinner()
protected GameMove[] listLegalMoves()
listLegalMoves in class AbstractGameprotected boolean pushMove(GameMove move)
pushMove in class AbstractGamemove - DOCUMENT ME!
protected boolean popMove()
popMove in class AbstractGamepublic java.lang.String toString()
toString in class AbstractGame
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in interface GamePlayclone in class AbstractGamejava.lang.CloneNotSupportedException - DOCUMENT ME!AbstractGame.spawnChild(GameMove)public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - DOCUMENT ME!
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||