|
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
algs.model.problems.tictactoe.model.PlaceMark
public class PlaceMark
Place a mark on the TicTacToe Board.
Field Summary | |
---|---|
protected int |
col
The column to contain the mark. |
protected Player |
player
The player making the move. |
protected int |
row
The row to contain the mark. |
Constructor Summary | |
---|---|
PlaceMark(int col,
int row,
Player player)
Construct a placeMark move with given (col,row) and mark to be placed. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object o)
Determine equality based on structure. |
boolean |
execute(IGameState gameState)
Place a mark on the TicTacToeBoard. |
int |
getColumn()
Return the column for this move. |
Player |
getPlayer()
Return the player for this move. |
int |
getRow()
Return the row for this move. |
boolean |
isValid(IGameState gameState)
Determines if move is valid. |
java.lang.String |
toString()
Return object in readable form. |
boolean |
undo(IGameState gameState)
Undoes the given move and returns true, or returns false if unable to undo. |
Methods inherited from class algs.model.problems.tictactoe.model.Move |
---|
hashCode |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int col
protected int row
protected Player player
Constructor Detail |
---|
public PlaceMark(int col, int row, Player player)
REQUIRES: player.mark != ' ' AND 0 <= col < # of columns in board AND 0 <= row < # of rows in board.
Method Detail |
---|
public boolean isValid(IGameState gameState)
isValid
in interface IGameMove
isValid
in class Move
gameState
- game tree state to be inspected by move
public boolean execute(IGameState gameState)
execute
in interface IGameMove
execute
in class Move
gameState
- game tree state to be updated by this move
public boolean undo(IGameState gameState)
undo
in interface IGameMove
undo
in class Move
gameState
- game tree state to be undone one moveMove.undo(IGameState)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- Object of class PlaceMark against which equality is being evaluated.public int getColumn()
public int getRow()
public Player getPlayer()
public java.lang.String toString()
toString
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 |