|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrules.GameState
public class GameState
An AntichessGameState is a GameState specific to Antichess. It represents all the information needed to play the game, but not auxiliary information like history and times. An AntichessGameState is mutable.
board
: maptomove
: color //The color of the player whose move it is
moveNum
: int //The number of moves that have passed
Abstract invariant: board is a valid antichess board.
Constructor Summary | |
---|---|
GameState()
Construct the initial GameState, representing the starting board position. |
|
GameState(Color p,
int n,
Board b)
Construct an Antichess-specific GameState. |
|
GameState(Color p,
int n,
String s)
Construct an Antichess-specific GameState |
|
GameState(Map<Position,Piece> powerupDiffs)
Construct the initial GameState, representing the starting board position. |
Method Summary | |
---|---|
String |
boardString()
Return the String representation of the board |
boolean |
canMove()
|
Color |
checkmater()
|
void |
checkRep()
|
GameState |
copy()
|
Board |
getBoard()
|
Color |
getCurrentColor()
|
int |
getMoveNum()
|
Map<Position,Piece> |
getPieceMap()
|
Collection<Piece> |
getPieces()
|
Color |
getWinner()
|
int |
hashCode()
|
boolean |
invalidState()
Is the current state invalid, by the opposite color being in check? |
boolean |
isLegal(Move m)
|
boolean |
isThreatened(Position pos,
Color color)
Does a color threaten a position? (occupying does not count). |
Collection<Move> |
legalMoves()
|
void |
makeMove(Move m)
Make a move |
Color |
piecesWinner()
|
boolean |
reversibleMakeMove(Map<Position,Piece> m,
boolean isForward)
Modify the AntichessGameState to apply a move, and turn the map into its inverse. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public GameState(Color p, int n, Board b)
public GameState(Color p, int n, String s)
public GameState()
public GameState(Map<Position,Piece> powerupDiffs)
Method Detail |
---|
public void checkRep()
public GameState copy()
public Board getBoard()
public Map<Position,Piece> getPieceMap()
public Color getCurrentColor()
public Color piecesWinner()
public Color checkmater()
public Color getWinner()
public String toString()
toString
in class Object
public int getMoveNum()
public boolean canMove()
public Collection<Move> legalMoves()
public boolean isThreatened(Position pos, Color color)
public boolean invalidState()
public boolean isLegal(Move m)
public Collection<Piece> getPieces()
public void makeMove(Move m)
public boolean reversibleMakeMove(Map<Position,Piece> m, boolean isForward)
public String boardString()
public int hashCode()
hashCode
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |