A local-LLM-powered Mafia game where you play against 8 AI agents, each driven by a distinct personality and an Ollama model.
9-player game (1 human + 8 AI). Roles are randomly assigned each game:
| Role | Count | Ability |
|---|---|---|
| Mafia | 2 | Eliminate one player each night |
| Doctor | 2 | Save one player each night |
| Sheriff | 1 | Investigate one player each night; diary is revealed on death |
| Villager | 4 | Vote out suspects during the day |
Each AI agent is randomly assigned a persona (Conspiracy Theorist, Cold Logician, Nervous Wreck, etc.) that shapes how they speak and vote.
- Python 3.10+
- Ollama running locally with
gemma3:12bpulled
ollama pull gemma3:12bInstall Python dependencies:
pip install -r requirements.txtpython game.pyEnter your name when prompted. Your role is revealed at the start of each game.
Night phase — Special roles act simultaneously:
- Mafia chooses a target to eliminate
- Doctor chooses a target to protect
- Sheriff investigates a player (result shown only to you if you are Sheriff)
Day phase — All living players discuss, then vote to execute one player. The executed player delivers last words before their role is revealed. Ties and abstains carry over; after two consecutive abstain rounds, voting becomes forced.
Sheriff diary — When the Sheriff dies (by elimination or execution), their full investigation history is publicly revealed and updates the game state for all AI agents.
Win conditions:
- Villagers win when all Mafia are eliminated
- Mafia wins when they equal or outnumber the remaining villagers
After each game you can export a full transcript via the Export Log button. Per-agent thought logs are written to agent_log_<Name>.txt during the game.
Change the model at the top of game.py:
DEFAULT_MODEL = "gemma3:12b"Any model available in your local Ollama installation can be substituted.