mixmeta4
Class Board

java.lang.Object
  extended by mixmeta4.Board
All Implemented Interfaces:
Environment, Percept, java.io.Serializable, java.lang.Cloneable, State

public class Board
extends java.lang.Object
implements Environment, Percept, State, java.lang.Cloneable, java.io.Serializable

See Also:
Serialized Form

Field Summary
 Game game
           
 BoardGUI gui
           
 Move lastMove
           
 int numColumns
          Deprecated, use getNumColumns().
 int numRows
          Deprecated, use getNumRows().
 boolean redToMove
          Deprecated, use getter redToMove().
 Move secondLastMove
           
 Square[][] squares
           
 boolean tty
           
 boolean visible
           
 
Constructor Summary
Board()
          Constructor used by clone().
Board(Game game, java.lang.String setup, boolean visible)
           
 
Method Summary
 boolean blackFinished()
          Assume black's pieces started in the first n rows.
 boolean blackKingTaken()
          Determine whether black king has been taken.
 java.lang.Object clone()
           
 boolean equals(java.lang.Object obj)
           
 void execute(Move move)
           
 boolean exists(java.awt.Point location)
           
 Actions getActions()
          Get the legal Moves for the current board configuration.
 Actions getActions(Piece piece)
          Get the Moves for a piece.
 PieceSet getBlackPieces()
           
 Game getGame()
           
 int getMovesSinceCapture()
          Get the number of moves (ply) since a piece was captured.
 Moves getMovesSoFar()
           
 int getNumColumns()
          get the number of columns in the board
 int getNumRows()
          get the number of rows in the board
 Percept getPercept()
           
 PieceSet getRedPieces()
           
 Square getSquare(java.awt.Point location)
           
 int hashCode()
           
 boolean redFinished()
          Assume red's pieces started in the first n rows.
 boolean redKingTaken()
          Determine whether red king has been taken.
 boolean redToMove()
          Find out who's turn it is to move.
 java.lang.String toString()
           
 void update(Action action)
          Updates the board by executing the move and toggling whose turn it is to move.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

gui

public BoardGUI gui

game

public Game game

redToMove

public boolean redToMove
Deprecated, use getter redToMove().


visible

public boolean visible

tty

public boolean tty

squares

public Square[][] squares

numRows

public int numRows
Deprecated, use getNumRows().


numColumns

public int numColumns
Deprecated, use getNumColumns().


lastMove

public Move lastMove

secondLastMove

public Move secondLastMove
Constructor Detail

Board

public Board(Game game,
             java.lang.String setup,
             boolean visible)

Board

public Board()
Constructor used by clone().

Method Detail

clone

public java.lang.Object clone()
Specified by:
clone in interface Environment
Specified by:
clone in interface State
Overrides:
clone in class java.lang.Object

getPercept

public Percept getPercept()
Specified by:
getPercept in interface Environment

update

public void update(Action action)
            throws java.lang.RuntimeException
Updates the board by executing the move and toggling whose turn it is to move.

Specified by:
update in interface Environment
Specified by:
update in interface State
Throws:
java.lang.RuntimeException

execute

public void execute(Move move)

getActions

public Actions getActions()
Get the legal Moves for the current board configuration.

Specified by:
getActions in interface State

getActions

public Actions getActions(Piece piece)
Get the Moves for a piece.


exists

public boolean exists(java.awt.Point location)

getSquare

public Square getSquare(java.awt.Point location)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getMovesSoFar

public Moves getMovesSoFar()

redFinished

public boolean redFinished()
Assume red's pieces started in the first n rows. This method returns true if the (remaining) pieces have reached last n rows.


blackFinished

public boolean blackFinished()
Assume black's pieces started in the first n rows. This method returns true if the (remaining) pieces have reached last n rows.


redKingTaken

public boolean redKingTaken()
Determine whether red king has been taken.


blackKingTaken

public boolean blackKingTaken()
Determine whether black king has been taken.


getGame

public Game getGame()

getRedPieces

public PieceSet getRedPieces()

getBlackPieces

public PieceSet getBlackPieces()

getNumRows

public int getNumRows()
get the number of rows in the board


getNumColumns

public int getNumColumns()
get the number of columns in the board


redToMove

public boolean redToMove()
Find out who's turn it is to move.

Returns:
true if its Red's move

getMovesSinceCapture

public int getMovesSinceCapture()
Get the number of moves (ply) since a piece was captured.