Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Mafia: Noir

A local-LLM-powered Mafia game where you play against 8 AI agents, each driven by a distinct personality and an Ollama model.

Overview

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.

Requirements

  • Python 3.10+
  • Ollama running locally with gemma3:12b pulled
ollama pull gemma3:12b

Install Python dependencies:

pip install -r requirements.txt

Running

python game.py

Enter your name when prompted. Your role is revealed at the start of each game.

Gameplay

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

Logs

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.

Configuration

Change the model at the top of game.py:

DEFAULT_MODEL = "gemma3:12b"

Any model available in your local Ollama installation can be substituted.

About

A Local LLM Based Mafia Board Game

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages