haive.games.mafia.mock_runner¶

Mock runner for the Mafia game.

This module provides a simplified version of the Mafia game runner that uses mock responses instead of actual LLMs, allowing for faster testing and demonstration without requiring API keys or internet access.

Examples

`bash python mock_runner.py --players 5 --days 1 --debug `

Classes¶

MockEngine

A mock engine that returns predefined responses.

Functions¶

generate_detective_response(context)

Generate a mock response for a detective player.

generate_doctor_response(context)

Generate a mock response for a doctor player.

generate_mafia_response(context)

Generate a mock response for a mafia player.

generate_narrator_response(context)

Generate a mock response for the narrator.

generate_villager_response(context)

Generate a mock response for a villager player.

main()

Main entry point for command-line execution.

run_mafia_game_mock([player_count, max_days, debug])

Run a mock Mafia game simulation with synthetic responses.

Module Contents¶

class haive.games.mafia.mock_runner.MockEngine(role)¶

A mock engine that returns predefined responses.

Init .

Parameters:

role – [TODO: Add description]

invoke(context)¶

Generate a mock response based on the role.

haive.games.mafia.mock_runner.generate_detective_response(context)¶

Generate a mock response for a detective player.

Parameters:

context (dict[str, Any])

Return type:

haive.games.mafia.models.MafiaPlayerDecision

haive.games.mafia.mock_runner.generate_doctor_response(context)¶

Generate a mock response for a doctor player.

Parameters:

context (dict[str, Any])

Return type:

haive.games.mafia.models.MafiaPlayerDecision

haive.games.mafia.mock_runner.generate_mafia_response(context)¶

Generate a mock response for a mafia player.

Parameters:

context (dict[str, Any])

Return type:

haive.games.mafia.models.MafiaPlayerDecision

haive.games.mafia.mock_runner.generate_narrator_response(context)¶

Generate a mock response for the narrator.

Parameters:

context (dict[str, Any])

Return type:

haive.games.mafia.models.NarratorDecision

haive.games.mafia.mock_runner.generate_villager_response(context)¶

Generate a mock response for a villager player.

Parameters:

context (dict[str, Any])

Return type:

haive.games.mafia.models.MafiaPlayerDecision

haive.games.mafia.mock_runner.main()¶

Main entry point for command-line execution.

haive.games.mafia.mock_runner.run_mafia_game_mock(player_count=5, max_days=1, debug=True)¶

Run a mock Mafia game simulation with synthetic responses.

This function sets up and executes a full Mafia game, handling:
  • Player creation and role assignment

  • Game state initialization

  • Turn-based gameplay execution using mock responses

  • State visualization

  • Game end conditions

Parameters:
  • player_count (int) – Total number of players including narrator. Must be at least 4 (3 players + narrator). Defaults to 5.

  • max_days (int) – Maximum number of in-game days before forcing game end. Defaults to 1.

  • debug (bool) – Enable debug mode for detailed logging. Defaults to True.

Raises:

ValueError – If player_count is less than 4.

Return type:

None