src.modules.backend.game_engine

Game engine module for handling the game logic when the computer selects a target word.

Classes

GameEngine([event_bus])

Handles the computer vs player game mode.

class src.modules.backend.game_engine.GameEngine(event_bus=None)[source]

Handles the computer vs player game mode.

__init__(event_bus=None)[source]

Initialize a new GameEngine instance.

The GameEngine maintains strict encapsulation by creating and controlling its own WordManager and StatsManager instances.

property game_id: str

Get the current game ID or raise an exception if there is no active game.

start_new_game()[source]

Start a new game by selecting a random target word.

Return type:

str

make_guess(guess, mode=None)[source]

Make a guess and return the result pattern and whether the game is won.

Parameters:
  • guess (str) – The word being guessed

  • mode (str) – Optional game mode identifier (manual, solver, etc.)

Return type:

Tuple[str, bool]

Returns:

(result_pattern, is_solved)

get_remaining_guesses()[source]

Get number of remaining guesses.

Return type:

int

is_game_won()[source]

Check if the game has been won.

Return type:

bool

is_game_over()[source]

Check if the game is over (won or max guesses reached).

Return type:

bool

get_game_state()[source]

Get current game state.

Return type:

Dict[str, object]

get_hint()[source]

Get a hint for the current game.

Return type:

str