|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A data model for (conway)go boards.
Why using an interface when there is only one implementation?
Because there isn't only one, one of the AI classes provides an own
read-only implementation, and you're free to write others.
A synchronized implementation does not exist yet.
$Id: Board.java,v 1.11 2004/12/23 21:42:43 mk Exp $
Method Summary | |
void |
addPiece(Field f)
Puts a piece (aka player) on the board. |
void |
addPiece(int col,
int row)
Puts a piece (aka player) on the board. |
java.lang.Object |
clone()
Returns a deep copy of this object. |
Field |
getBall()
Returns the actual field of the ball. |
void |
move(Move move)
Makes a move. |
byte |
on(Field field)
Returns the content of the specified field on the board. |
byte |
on(int col,
int row)
Returns the content of the field on the specified row and column. |
void |
removePiece(Field f)
Removes a piece (aka player) from the board. |
void |
removePiece(int col,
int row)
Removes a piece (aka player) from the board. |
void |
reset()
Initializes the field, setting it to the start position. |
void |
setBall(Field newBallField)
Sets the actual field of the ball. |
void |
setBall(int col,
int row)
Sets the actual field of the ball. |
byte[][] |
toArray()
Returns this object as a two-dimensional array containing the contents of the fields. |
Board |
upsideDown()
Returns a copy of this board mirrored along the x-axis. |
boolean |
whoseTurn()
Returns the player who has to move. |
Method Detail |
public void reset()
public Board upsideDown()
public java.lang.Object clone()
public byte[][] toArray()
public boolean whoseTurn()
public byte on(int col, int row)
public byte on(Field field)
public Field getBall()
public void setBall(Field newBallField)
public void setBall(int col, int row)
public void addPiece(Field f)
public void addPiece(int col, int row)
public void removePiece(Field f)
public void removePiece(int col, int row)
public void move(Move move) throws InvalidMoveException
InvalidMoveException
- If the move was not correct.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |