games.single_player.flow_free.state_manager¶
State manager for Flow Free game logic and mechanics.
This module handles game initialization, move validation, and state transitions for the Flow Free puzzle game.
Classes¶
Manager for Flow Free game state. |
Module Contents¶
- class games.single_player.flow_free.state_manager.FlowFreeStateManager¶
Bases:
haive.games.single_player.base.SinglePlayerStateManager
[haive.games.single_player.flow_free.state.FlowFreeState
]Manager for Flow Free game state.
- classmethod apply_move(state, move)¶
Apply a move to the current state.
- Parameters:
state (haive.games.single_player.flow_free.state.FlowFreeState) – Current game state.
move (haive.games.single_player.flow_free.models.FlowFreeMove) – Move to apply.
- Returns:
Updated game state.
- Raises:
ValueError – If the move is invalid.
- Return type:
- classmethod check_game_status(state)¶
Check and update the game status.
- Parameters:
state (haive.games.single_player.flow_free.state.FlowFreeState) – Current game state.
- Returns:
Updated game state with status checked.
- Return type:
- classmethod generate_hint(state)¶
Generate a hint for the current game state.
- Parameters:
state (haive.games.single_player.flow_free.state.FlowFreeState) – Current game state.
- Returns:
Tuple of (updated state, hint text).
- Return type:
tuple[haive.games.single_player.flow_free.state.FlowFreeState, str]
- classmethod get_legal_moves(state)¶
Get all legal moves for the current state.
- Parameters:
state (haive.games.single_player.flow_free.state.FlowFreeState) – Current game state.
- Returns:
List of all legal moves.
- Return type:
list[haive.games.single_player.flow_free.models.FlowFreeMove]
- classmethod initialize(difficulty=GameDifficulty.MEDIUM, player_type=PlayerType.LLM, rows=5, cols=5, num_flows=None, **kwargs)¶
Initialize a new Flow Free game state.
- Parameters:
difficulty (haive.games.single_player.base.GameDifficulty) – Difficulty level of the game.
player_type (haive.games.single_player.base.PlayerType) – Type of player.
rows (int) – Number of rows in the grid.
cols (int) – Number of columns in the grid.
num_flows (int | None) – Number of flows to include. If None, determined by difficulty.
**kwargs – Additional initialization parameters.
- Returns:
A new Flow Free game state.
- Return type:
- classmethod interactive_input(state, user_input)¶
Process interactive input from the player.
- Parameters:
state (haive.games.single_player.flow_free.state.FlowFreeState) – Current game state.
user_input (str) – User input string.
- Returns:
Updated game state.
- Return type: