haive.games.fox_and_geese.state_manager ======================================= .. py:module:: haive.games.fox_and_geese.state_manager .. autoapi-nested-parse:: State manager for the Fox and Geese game. This module defines the state manager for the Fox and Geese game, which manages the state of the game and provides methods for initializing, applying moves, checking game status, and getting legal moves for the Fox and Geese game. Classes ------- .. autoapisummary:: haive.games.fox_and_geese.state_manager.FoxAndGeeseStateManager Module Contents --------------- .. py:class:: FoxAndGeeseStateManager Bases: :py:obj:`haive.games.framework.base.state_manager.GameStateManager`\ [\ :py:obj:`haive.games.fox_and_geese.state.FoxAndGeeseState`\ ] Manager for Fox and Geese game state. This class provides methods for initializing, applying moves, checking game status, and getting legal moves for the Fox and Geese game. .. py:method:: apply_move(state, move) :classmethod: Apply a move to the Fox and Geese state. This method updates the state of the game based on the move made by the current player. It handles both regular moves and capture moves, updating the position of the fox and geese accordingly. It also updates the move history and switches turns between fox and geese. .. py:method:: check_game_status(state) :classmethod: Check and update game status. This method checks the current game status and updates the state accordingly. It determines if the fox has won by capturing too many geese or if the geese have won by trapping the fox. It also updates the game status and winner. .. py:method:: get_legal_moves(state) :classmethod: Get all legal moves for the current state. This method returns a list of all legal moves for the current player in the given game state. It checks the current player's turn and calls the appropriate method to get the legal moves for the fox or geese. .. py:method:: initialize() :classmethod: Initialize a new Fox and Geese game. Creates initial game state with fox in center position and geese arranged in checkerboard pattern on the first two rows. :returns: Initial game state with positions set up. :rtype: FoxAndGeeseState