chmutils.game_builder¶
GBuilder class that overrides GameBuilder.handle_error to raise exception.
Classes
|
Overrides GameBuilder.handle_error to raise exception. |
- class chmutils.game_builder.GBuilder(*args, **kwds)¶
Bases:
GameBuilder
Overrides GameBuilder.handle_error to raise exception.
- begin_game() None ¶
Called at the start of a game.
- begin_headers() Headers ¶
Called before visiting game headers.
- begin_parse_san(board: Board, san: str) Optional[SkipType] ¶
When the visitor is used by a parser, this is called at the start of each standard algebraic notation detailing a move.
- begin_variation() None ¶
Called at the start of a new variation. It is not called for the mainline of the game.
- end_game() None ¶
Called at the end of a game.
- end_headers() Optional[SkipType] ¶
Called after visiting game headers.
- end_variation() None ¶
Concludes a variation.
- handle_error(error: Exception) None ¶
Override of GameBuilder.handle_error method to raise errors.
- parse_san(board: Board, san: str) Move ¶
When the visitor is used by a parser, this is called to parse a move in standard algebraic notation.
You can override the default implementation to work around specific quirks of your input format.
Deprecated since version 1.1: This method is very limited, because it is only called on moves that the parser recognizes in the first place. Instead of adding workarounds here, please report common quirks so that they can be handled for everyone.
- result() GameT ¶
Returns the visited
Game()
.
- visit_board(board: Board) None ¶
Called for the starting position of the game and after each move.
The board state must be restored before the traversal continues.
- visit_comment(comment: str) None ¶
Called for each comment.
- visit_header(tagname: str, tagvalue: str) None ¶
Called for each game header.
- visit_move(board: Board, move: Move) None ¶
Called for each move.
board is the board state before the move. The board state must be restored before the traversal continues.
- visit_nag(nag: int) None ¶
Called for each NAG.
- visit_result(result: str) None ¶
Called at the end of a game with the value from the
Result
header.