haive.games.connect4.agent ========================== .. py:module:: haive.games.connect4.agent .. autoapi-nested-parse:: Agent for playing Connect 4. This module defines the Connect 4 agent, which uses language models to generate moves and analyze positions in the game. Classes ------- .. autoapisummary:: haive.games.connect4.agent.Connect4Agent Module Contents --------------- .. py:class:: Connect4Agent(config) Bases: :py:obj:`haive.games.framework.base.agent.GameAgent`\ [\ :py:obj:`haive.games.connect4.config.Connect4AgentConfig`\ ] Agent for playing Connect 4. This class implements the Connect 4 agent, which uses language models to generate moves and analyze positions in the game. Init . :param config: [TODO: Add description] .. py:method:: analyze_player1(state) Analyze position for the red player. This method analyzes the position for the red player in the current game state. .. py:method:: analyze_player2(state) Analyze position for the yellow player. This method analyzes the position for the yellow player in the current game state. .. py:method:: extract_move(response) Extract move from engine response. This method extracts the move from the engine response. .. py:method:: make_player1_move(state) Make a move for the red player. This method makes a move for the red player in the current game state. .. py:method:: make_player2_move(state) Make a move for the yellow player. This method makes a move for the yellow player in the current game state. .. py:method:: prepare_analysis_context(state, player) Prepare context for position analysis with correct variables. This method prepares the context for position analysis by calculating threats and formatting the required fields. .. py:method:: prepare_move_context(state, player) Prepare context for move generation. This method prepares the context for move generation by formatting the legal moves and getting the player's last analysis. .. py:method:: visualize_state(state) Visualize the current game state with better formatting and insights. This method visualizes the current game state with better formatting and insights. It displays the current player, game status, board, last move, and analysis from the previous turn.