chipiron.games package
Subpackages
- chipiron.games.game package
- Submodules
- chipiron.games.game.final_game_result module
- chipiron.games.game.game module
GameObservableGameObservableGame.boardObservableGame.fen_historyObservableGame.gameObservableGame.is_paused()ObservableGame.is_play()ObservableGame.mailboxes_displayObservableGame.move_functionsObservableGame.move_historyObservableGame.notify_display()ObservableGame.notify_status()ObservableGame.play_move()ObservableGame.playing_statusObservableGame.query_move_from_players()ObservableGame.register_display()ObservableGame.register_player()ObservableGame.rewind_one_move()ObservableGame.set_pause_status()ObservableGame.set_play_status()
- chipiron.games.game.game_args module
- chipiron.games.game.game_args_factory module
- chipiron.games.game.game_manager module
GameManagerGameManager.argsGameManager.display_board_evaluatorGameManager.external_eval()GameManager.gameGameManager.game_continue_conditions()GameManager.main_thread_mailboxGameManager.move_factoryGameManager.output_folder_pathGameManager.play_one_game()GameManager.play_one_move()GameManager.player_color_to_idGameManager.playersGameManager.print_to_file()GameManager.processing_mail()GameManager.progress_collectorGameManager.rewind_one_move()GameManager.simple_results()GameManager.syzygyGameManager.tell_results()GameManager.terminate_processes()
- chipiron.games.game.game_manager_factory module
GameManagerFactoryGameManagerFactory.board_factoryGameManagerFactory.create()GameManagerFactory.game_manager_board_evaluatorGameManagerFactory.implementation_argsGameManagerFactory.main_thread_mailboxGameManagerFactory.move_factoryGameManagerFactory.output_folder_pathGameManagerFactory.subscribe()GameManagerFactory.subscribersGameManagerFactory.syzygy_tableGameManagerFactory.universal_behavior
- chipiron.games.game.game_playing_status module
- chipiron.games.game.observable_game_playing_status module
- chipiron.games.game.progress_collector module
- chipiron.games.game.test_game module
- Module contents
GameGameArgsGameArgsFactoryObservableGameObservableGame.boardObservableGame.fen_historyObservableGame.gameObservableGame.is_paused()ObservableGame.is_play()ObservableGame.mailboxes_displayObservableGame.move_functionsObservableGame.move_historyObservableGame.notify_display()ObservableGame.notify_status()ObservableGame.play_move()ObservableGame.playing_statusObservableGame.query_move_from_players()ObservableGame.register_display()ObservableGame.register_player()ObservableGame.rewind_one_move()ObservableGame.set_pause_status()ObservableGame.set_play_status()
- chipiron.games.match package
- Submodules
- chipiron.games.match.MatchTag module
- chipiron.games.match.match_args module
- chipiron.games.match.match_factories module
- chipiron.games.match.match_manager module
- chipiron.games.match.match_results module
IMatchResultsMatchReportMatchResultsMatchResults.add_result_one_game()MatchResults.finish()MatchResults.get_draws()MatchResults.get_player_one_wins()MatchResults.get_player_two_wins()MatchResults.get_simple_result()MatchResults.match_finishedMatchResults.number_of_gamesMatchResults.player_one_is_white_black_winsMatchResults.player_one_is_white_drawsMatchResults.player_one_is_white_white_winsMatchResults.player_one_name_idMatchResults.player_two_is_white_black_winsMatchResults.player_two_is_white_drawsMatchResults.player_two_is_white_white_winsMatchResults.player_two_name_id
SimpleResults
- chipiron.games.match.match_results_factory module
- chipiron.games.match.match_settings_args module
- chipiron.games.match.observable_match_result module
ObservableMatchResultsObservableMatchResults.match_resultsObservableMatchResults.mailboxesObservableMatchResults.copy_match_result()ObservableMatchResults.notify_new_results()ObservableMatchResults.get_simple_result()ObservableMatchResults.finish()ObservableMatchResults.__str__()ObservableMatchResults.add_result_one_game()ObservableMatchResults.copy_match_result()ObservableMatchResults.finish()ObservableMatchResults.get_simple_result()ObservableMatchResults.mailboxesObservableMatchResults.match_resultsObservableMatchResults.notify_new_results()ObservableMatchResults.subscribe()
- chipiron.games.match.utils module
- Module contents
Module contents
Module for managing games.
- class chipiron.games.GamePlayingStatus(_status: PlayingStatus = PlayingStatus.PLAY)[source]
Bases:
objectObject containing the playing status of a game and the board.
- is_paused() bool[source]
Check if the game is currently paused.
- Returns:
True if the game is paused, False otherwise.
- Return type:
bool
- is_play() bool[source]
Check if the game is currently playing.
- Returns:
True if the game is playing, False otherwise.
- Return type:
bool
- property status: PlayingStatus
Get the current playing status of the game.
- Returns:
The current playing status.
- Return type:
- class chipiron.games.MatchManager(player_one_id: str, player_two_id: str, game_manager_factory: GameManagerFactory, game_args_factory: GameArgsFactory, match_results_factory: MatchResultsFactory, output_folder_path: str | PathLike[str] | None = None)[source]
Bases:
objectObject in charge of playing one match
- Parameters:
player_one_id (str) – The ID of player one.
player_two_id (str) – The ID of player two.
game_manager_factory (GameManagerFactory) – The factory for creating game managers.
game_args_factory (GameArgsFactory) – The factory for creating game arguments.
match_results_factory (MatchResultsFactory) – The factory for creating match results.
output_folder_path (path | None, optional) – The path to the output folder. Defaults to None.
- play_one_game(player_color_to_factory_args: dict[bool, chipiron.players.player_args.PlayerFactoryArgs], args_game: GameArgs, game_number: int, game_seed: int) GameReport[source]
Plays one game and returns the game report.
- Parameters:
player_color_to_factory_args (dict[chess.Color, PlayerFactoryArgs]) – A dictionary mapping player colors to their factory arguments.
args_game (GameArgs) – The arguments for the game.
game_number (int) – The number of the game.
game_seed (seed) – The seed for the game.
- Returns:
The report of the game.
- Return type:
- play_one_match() MatchReport[source]
Plays one match and returns the match report.
This method plays a single match, which consists of multiple games. It generates game arguments, plays each game, updates the match results, and saves the match report to a file.
- Returns:
The report of the match, including the move history and match results.
- Return type:
- print_info() None[source]
Prints the information about the players in the match.
This method prints the IDs of player one and player two.
- Parameters:
None –
- Returns:
None
- print_stats_to_file(match_results: IMatchResults) None[source]
Prints the match statistics to a file.
- Parameters:
match_results (IMatchResults) – The match results object containing the statistics.
- save_match_report_to_file(match_report: MatchReport) None[source]
Save the match report to a file.
- Parameters:
match_report (MatchReport) – The match report to be saved.
- subscribe(subscriber: Queue[IsDataclass]) None[source]
Subscribe a subscriber to receive updates from the match manager.
- Parameters:
subscriber (queue.Queue[IsDataclass]) – The subscriber to be added to the list of subscribers.
- class chipiron.games.ObservableGamePlayingStatus(game_playing_status: GamePlayingStatus)[source]
Bases:
objectAn observable version of GamePlayingStatus that notifies subscribers. Players and GUI can then decide what to do with this information.
- is_paused() bool[source]
Checks if the game is currently paused.
- Returns:
True if the game is paused, False otherwise.
- Return type:
bool
- is_play() bool[source]
Checks if the game is currently being played.
- Returns:
True if the game is being played, False otherwise.
- Return type:
bool
- property status: PlayingStatus
Gets the current playing status.
- Returns:
The current playing status.
- Return type:
- subscribe(mailboxes: list[queue.Queue[chipiron.utils.communication.gui_messages.game_status_message.GameStatusMessage]]) None[source]
Subscribes the given mailboxes to receive game status updates.
- Parameters:
mailboxes (list[queue.Queue[GameStatusMessage]]) – The mailboxes to subscribe.