rules
Class Board

java.lang.Object
  extended by rules.Board

public class Board
extends Object

The board for a game represented as a map from postions to pieces.

Specification Fields :
positions_to_pieces : map // map from postions to pieces.

Field Summary
static long serialVersionUID
           
static String startingBoard
          The initial board string for a game.
 
Constructor Summary
Board()
           
 
Method Summary
 Board copy()
           
static Board fromString(String s)
          Creates a board from a string representation (see startingBoard for an example string)
 Piece get(int x, int y)
           
 Piece get(Position pos)
           
 Collection<Piece> getPieces()
           
 Position kingPosition(Color c)
           
 void put(int x, int y, Piece piece)
           
 void put(Position pos, Piece piece)
           
 String toString()
          Outputs a string representation of a board.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

startingBoard

public static final String startingBoard
The initial board string for a game.
 "rnbqkbnr\npppppppp        \n        \n        \n        \nPPPPPPPP\nRNBQKBNR\n"
 

See Also:
Constant Field Values

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

Board

public Board()
Method Detail

fromString

public static Board fromString(String s)
Creates a board from a string representation (see startingBoard for an example string)

Parameters:
s - String representation of the board.
Returns:
board corresponding to the string

toString

public String toString()
Outputs a string representation of a board. (see startingBoard for an example string)

Overrides:
toString in class Object

put

public void put(Position pos,
                Piece piece)

put

public void put(int x,
                int y,
                Piece piece)

get

public Piece get(Position pos)

get

public Piece get(int x,
                 int y)

getPieces

public Collection<Piece> getPieces()

kingPosition

public Position kingPosition(Color c)

copy

public Board copy()