Table of Contents

Class: Game chess.py

Encapsulates a game.

Methods   
__init__
advance
checked
checkmated
disambiguate
ensure
isPlaying
load
move
ok
save
show
whose
  __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.

Exceptions   
EmptySquareError
IllegalMoveError, "enemy 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?


Table of Contents

This document was automatically generated on Thu Jul 25 17:22:53 2002 by HappyDoc version 2.0.1