rules
Class Board
java.lang.Object
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.
Constructor Summary |
Board()
|
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
Board
public Board()
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()