|
Algorithm Development Kit 1.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectalgs.model.problems.tictactoe.model.Move
public abstract class Move
Represents a Move on the TicTacToe Board.
At this level of abstraction, we cannot define an Abstraction Function because there is no known representation.
However, we must state unequivocally that each Move
object must define
a proper toString() because otherwise the hashCode method defined here
will not work.
Also, the equals(Object o) method must be implemented by all subclasses.
Constructor Summary | |
---|---|
Move()
|
Method Summary | |
---|---|
abstract boolean |
execute(IGameState board)
Makes the move on the given TicTacToe Board. |
int |
hashCode()
Ensure that we can use Move objects within hashtables by simplying calculating hashCode values based upon toString() for the Move subclasses. |
abstract boolean |
isValid(IGameState board)
Determines if move can be made on the given TicTacToe Board. |
abstract boolean |
undo(IGameState board)
Removes the effect of the move from the TicTacToe Board. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Move()
Method Detail |
---|
public abstract boolean isValid(IGameState board)
isValid
in interface IGameMove
board
- game tree state to be inspected by move
public abstract boolean execute(IGameState board)
execute
in interface IGameMove
board
- game tree state to be updated by this move
public abstract boolean undo(IGameState board)
undo
in interface IGameMove
board
- game tree state to be undone one movepublic int hashCode()
hashCode
in class java.lang.Object
|
Algorithm Development Kit 1.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |