chipiron.players.boardevaluators.table_base package
Submodules
chipiron.players.boardevaluators.table_base.factory module
Module to create a SyzygyTable object if the path to the syzygy tables exists, otherwise return None.
- class chipiron.players.boardevaluators.table_base.factory.SyzygyFactory(*args, **kwargs)[source]
Bases:
Protocol
- class chipiron.players.boardevaluators.table_base.factory.SyzygyProvider(*args, **kwargs)[source]
Bases:
Protocol- provide() SyzygyChiTable | None[source]
- chipiron.players.boardevaluators.table_base.factory.create_syzygy(use_rust: bool) SyzygyTable[Any] | None[source]
Create a SyzygyTable object
- chipiron.players.boardevaluators.table_base.factory.create_syzygy_factory(use_rust: bool) SyzygyFactory[source]
Create a SyzygyTable object
- chipiron.players.boardevaluators.table_base.factory.create_syzygy_python() SyzygyChiTable | None[source]
Create a SyzygyTable object if the path to the syzygy tables exists, otherwise return None.
- Returns:
The created SyzygyTable object or None if the path does not exist.
- Return type:
SyzygyTable | None
- chipiron.players.boardevaluators.table_base.factory.create_syzygy_rust() SyzygyRustTable | None[source]
Create a SyzygyTable object if the path to the syzygy tables exists, otherwise return None.
- Returns:
The created SyzygyTable object or None if the path does not exist.
- Return type:
SyzygyTable | None
chipiron.players.boardevaluators.table_base.syzygy_python module
Module for the SyzygyTable class.
- class chipiron.players.boardevaluators.table_base.syzygy_python.SyzygyChiTable(path_to_table: str | PathLike[str])[source]
Bases:
SyzygyTable[BoardChi]A class representing a Syzygy tablebase for chess endgame analysis.
- Variables:
table_base (chess.syzygy.Tablebase) – The Syzygy tablebase object.
- fast_in_table(board
boards.BoardChi) -> bool: Check if the given board is suitable for fast tablebase lookup.
- in_table(board
boards.BoardChi) -> bool: Check if the given board is in the tablebase.
- get_over_event(board
boards.BoardChi) -> tuple[Winner, HowOver]: Get the winner and how the game is over for the given board.
- val(board
boards.BoardChi) -> int: Get the value of the given board from the tablebase.
- value_white(board
boards.BoardChi) -> int: Get the value of the given board for the white player.
- get_over_tag(board
boards.BoardChi) -> OverTags: Get the over tag for the given board.
- string_result(board
boards.BoardChi) -> str: Get the string representation of the result for the given board.
- dtz(board
boards.BoardChi) -> int: Get the distance-to-zero (DTZ) value for the given board.
- best_move(board
boards.BoardChi) -> chess.Move: Get the best move according to the tablebase for the given board.
- dtz(board: BoardChi) int[source]
Get the distance-to-zero (DTZ) value for the given board.
- Parameters:
board (boards.BoardChi) – The board to get the DTZ value for.
- Returns:
The DTZ value for the board.
- Return type:
int
- table_base: Tablebase
chipiron.players.boardevaluators.table_base.syzygy_rust module
Module for the SyzygyTable class.
- class chipiron.players.boardevaluators.table_base.syzygy_rust.SyzygyRustTable(path_to_table: str | PathLike[str])[source]
Bases:
SyzygyTable[RustyBoardChi]A class representing a Syzygy tablebase for chess endgame analysis.
- Variables:
table_base (chess.syzygy.Tablebase) – The Syzygy tablebase object.
- fast_in_table(board
boards.BoardChi) -> bool: Check if the given board is suitable for fast tablebase lookup.
- in_table(board
boards.BoardChi) -> bool: Check if the given board is in the tablebase.
- get_over_event(board
boards.BoardChi) -> tuple[Winner, HowOver]: Get the winner and how the game is over for the given board.
- val(board
boards.BoardChi) -> int: Get the value of the given board from the tablebase.
- value_white(board
boards.BoardChi) -> int: Get the value of the given board for the white player.
- get_over_tag(board
boards.BoardChi) -> OverTags: Get the over tag for the given board.
- string_result(board
boards.BoardChi) -> str: Get the string representation of the result for the given board.
- dtz(board
boards.BoardChi) -> int: Get the distance-to-zero (DTZ) value for the given board.
- best_move(board
boards.BoardChi) -> chess.Move: Get the best move according to the tablebase for the given board.
- dtz(board: RustyBoardChi) int[source]
Get the distance-to-zero (DTZ) value for the given board.
- Parameters:
board (boards.BoardChi) – The board to get the DTZ value for.
- Returns:
The DTZ value for the board.
- Return type:
int
- table_base: MyTableBase
- wdl(board: RustyBoardChi) int[source]
chipiron.players.boardevaluators.table_base.syzygy_table module
Module for the SyzygyTable class.
- class chipiron.players.boardevaluators.table_base.syzygy_table.SyzygyTable(*args, **kwargs)[source]
Bases:
Protocol,GenericA class representing a Syzygy tablebase for chess endgame analysis.
- Variables:
table_base (chess.syzygy.Tablebase) – The Syzygy tablebase object.
- fast_in_table(board
boards.BoardChi) -> bool: Check if the given board is suitable for fast tablebase lookup.
- in_table(board
boards.BoardChi) -> bool: Check if the given board is in the tablebase.
- get_over_event(board
boards.BoardChi) -> tuple[Winner, HowOver]: Get the winner and how the game is over for the given board.
- val(board
boards.BoardChi) -> int: Get the value of the given board from the tablebase.
- value_white(board
boards.BoardChi) -> int: Get the value of the given board for the white player.
- get_over_tag(board
boards.BoardChi) -> OverTags: Get the over tag for the given board.
- string_result(board
boards.BoardChi) -> str: Get the string representation of the result for the given board.
- dtz(board
boards.BoardChi) -> int: Get the distance-to-zero (DTZ) value for the given board.
- best_move(board
boards.BoardChi) -> chess.Move: Get the best move according to the tablebase for the given board.
- best_move(board: T_Board) int[source]
Get the best move according to the tablebase for the given board.
- Parameters:
board (boards.BoardChi) – The board to find the best move for.
- Returns:
The best move according to the tablebase.
- Return type:
chess.Move
- dtz(board: T_Board) int[source]
Get the distance-to-zero (DTZ) value for the given board.
- Parameters:
board (boards.BoardChi) – The board to get the DTZ value for.
- Returns:
The DTZ value for the board.
- Return type:
int
- fast_in_table(board: T_Board) bool[source]
Check if the given board is suitable for fast tablebase lookup.
- Parameters:
board (boards.BoardChi) – The board to check.
- Returns:
True if the board is suitable for fast lookup, False otherwise.
- Return type:
bool
- get_over_event(board: T_Board) tuple[chipiron.players.boardevaluators.over_event.Winner, chipiron.players.boardevaluators.over_event.HowOver][source]
Get the winner and how the game is over for the given board.
- get_over_tag(board: T_Board) OverTags[source]
Get the over tag for the given board.
- Parameters:
board (boards.BoardChi) – The board to get the over tag for.
- Returns:
The over tag for the board.
- Return type:
- in_table(board: T_Board) bool[source]
Check if the given board is in the tablebase.
- Parameters:
board (boards.BoardChi) – The board to check.
- Returns:
True if the board is in the tablebase, False otherwise.
- Return type:
bool
- string_result(board: T_Board) str[source]
Get the string representation of the result for the given board.
- Parameters:
board (boards.BoardChi) – The board to get the result for.
- Returns:
The string representation of the result.
- Return type:
str
- val(board: T_Board) int[source]
Get the value of the given board from the tablebase.
- Parameters:
board (boards.BoardChi) – The board to get the value for.
- Returns:
The value of the board from the tablebase.
- Return type:
int
chipiron.players.boardevaluators.table_base.syzygy_thread module
Module that contains the SyzygyProcess class.
- class chipiron.players.boardevaluators.table_base.syzygy_thread.SyzygyProcess(syzygy_table: SyzygyTable[Any], queue_board: Queue[Any])[source]
Bases:
ProcessA class that extends the Process class from the multiprocessing module. This class represents a separate process that runs in parallel with the main program.
- Variables:
syzygy_table (SyzygyTable) – The SyzygyTable object used for tablebase lookups.
queue_board (queue.Queue) – The queue used for receiving board messages from the main program.
Module contents
This module provides functionality for creating and using table bases for board evaluation.
- Table bases are precomputed endgame databases that store optimal moves for every possible position in a specific
- endgame scenario. These databases can be used to improve the performance of board evaluation algorithms
by providing accurate evaluations for endgame positions.
This module exports the following functions and classes: - create_syzygy: A function for creating a SyzygyTable object. - SyzygyTable: A class representing a table base for endgame evaluation.
- class chipiron.players.boardevaluators.table_base.SyzygyTable(*args, **kwargs)[source]
Bases:
Protocol,GenericA class representing a Syzygy tablebase for chess endgame analysis.
- Variables:
table_base (chess.syzygy.Tablebase) – The Syzygy tablebase object.
- fast_in_table(board
boards.BoardChi) -> bool: Check if the given board is suitable for fast tablebase lookup.
- in_table(board
boards.BoardChi) -> bool: Check if the given board is in the tablebase.
- get_over_event(board
boards.BoardChi) -> tuple[Winner, HowOver]: Get the winner and how the game is over for the given board.
- val(board
boards.BoardChi) -> int: Get the value of the given board from the tablebase.
- value_white(board
boards.BoardChi) -> int: Get the value of the given board for the white player.
- get_over_tag(board
boards.BoardChi) -> OverTags: Get the over tag for the given board.
- string_result(board
boards.BoardChi) -> str: Get the string representation of the result for the given board.
- dtz(board
boards.BoardChi) -> int: Get the distance-to-zero (DTZ) value for the given board.
- best_move(board
boards.BoardChi) -> chess.Move: Get the best move according to the tablebase for the given board.
- best_move(board: T_Board) int[source]
Get the best move according to the tablebase for the given board.
- Parameters:
board (boards.BoardChi) – The board to find the best move for.
- Returns:
The best move according to the tablebase.
- Return type:
chess.Move
- dtz(board: T_Board) int[source]
Get the distance-to-zero (DTZ) value for the given board.
- Parameters:
board (boards.BoardChi) – The board to get the DTZ value for.
- Returns:
The DTZ value for the board.
- Return type:
int
- fast_in_table(board: T_Board) bool[source]
Check if the given board is suitable for fast tablebase lookup.
- Parameters:
board (boards.BoardChi) – The board to check.
- Returns:
True if the board is suitable for fast lookup, False otherwise.
- Return type:
bool
- get_over_event(board: T_Board) tuple[chipiron.players.boardevaluators.over_event.Winner, chipiron.players.boardevaluators.over_event.HowOver][source]
Get the winner and how the game is over for the given board.
- get_over_tag(board: T_Board) OverTags[source]
Get the over tag for the given board.
- Parameters:
board (boards.BoardChi) – The board to get the over tag for.
- Returns:
The over tag for the board.
- Return type:
- in_table(board: T_Board) bool[source]
Check if the given board is in the tablebase.
- Parameters:
board (boards.BoardChi) – The board to check.
- Returns:
True if the board is in the tablebase, False otherwise.
- Return type:
bool
- string_result(board: T_Board) str[source]
Get the string representation of the result for the given board.
- Parameters:
board (boards.BoardChi) – The board to get the result for.
- Returns:
The string representation of the result.
- Return type:
str
- val(board: T_Board) int[source]
Get the value of the given board from the tablebase.
- Parameters:
board (boards.BoardChi) – The board to get the value for.
- Returns:
The value of the board from the tablebase.
- Return type:
int