Encapsulates a game.
Methods
|
|
|
|
__init__
|
__init__ (
self,
white=None,
black=None,
)
|
|
advance
|
advance ( self )
|
|
checked
|
checked ( self )
Return who is in check or None.
|
|
checkmated
|
checkmated ( self )
Return which color has been checkmated or None.
|
|
disambiguate
|
disambiguate ( self, command )
Disambiguate a move given by COMMAND and return a 2-tuple of
the starting and ending positions.
Exceptions
|
|
AmbiguousMoveError, "multiple legal moves"
IllegalMoveError, "cannot promote to king, pawn"
IllegalMoveError, "no legal moves"
IllegalMoveError, "pawn would not promote"
IllegalMoveError, "would not capture"
IllegalMoveError, "would not check"
ParseError, "error during parsing"
|
|
|
ensure
|
ensure (
self,
loc,
color,
)
Ensure that LOC is occupied by a COLOR piece.
|
|
isPlaying
|
isPlaying ( self, player )
Return true if PLAYER is participating in this game.
|
|
load
|
load ( self, file )
Load the state of the game from FILE.
Exceptions
|
|
FileFormatError, "invalid move"
FileFormatError, "miscellaneous error"
FileFormatError, "wrong number of piece fields"
FileFormatError, "wrong number of player names"
|
|
|
move
|
move ( self, command )
Commit a move given by COMMAND and return a move indicating it.
|
|
ok
|
ok ( self )
Is the game done?
|
|
save
|
save ( self, file )
Save the state of the game to FILE.
|
|
show
|
show ( self )
Return an ASCII representation of the board.
|
|
whose
|
whose ( self )
Whose turn is it?
|