Skip to content
Honorable Mention

The Turing Werewolf

The Turing Werewolf turns the classic social deduction game Werewolf into a solo experience powered. Each player you meet is a Chrome Prompt API that debates, and deceives, all running locally.

Core trick

Each NPC is a separate on-device Prompt API session returning JSON speech and hidden reasoning, while a Rewriter pass neutralizes the player's style.

Tags

Built with

chromejavascriptreacttailwindcss

Description

Inspiration I wanted to see if the built-in AI could make social deduction games playable as a solo player. Werewolf (also known as Mafia) is a perfect example for that, since it is all about deception, deduction, and language. I wanted a human-feeling Werewolf game where the user plays against a room of Chrome AI villagers and werewolves, all running locally in their browser. I also wanted to test if it is possible to create a set of AI that can interact and think humanly under certain constraints. What it does The Turing Werewolf is a client-side web application game where you play as a villager, werewolf or fool. Every other player are AI agents using Chrome's built-in AI that converse, accuse, and vote like humans. Core features: Turn-based conversation : Chrome AI NPCs take turns to speak and reason about suspects. Style Normaliser : your messages can be rewritten into neutral English before being sent, so the AI cannot “meta-read” your grammar or style. Structured reasoning : each agent outputs both public speech and hidden logic (in JSON). Voting system : after discussion, everyone secretly votes to lynch a suspect. Each NPC runs as its cloned Prompt API session with their own prompt: Agent includes the game state and asks for an action (speak/vote/kill). NPC responds with structured JSON. How we built it Tech stack Frontend : JavaScript / React / TailwindCSS AI layer : Chrome’s Prompt API for per-agent reasoning sessions and Rewriter API to provide player with the option neutralise or refine their messages before sending so as to prevent AI agents from detecting personal writing patterns. Local state : XState with persistence Schema Validator : JSON schemas enforced in-browser to keep AI responses consistent API used Prompt API: To build the core gameplay aka the NPCs talking Rewriter API: To allow the player to use neutral English speech Challenges we ran into The LLMs often spoke unnaturally and failed to maintain conversational flow, even with extensive context. Implementing structured turn-taking was necessary to improve realism. Some prompts were ignored, even when explicitly told not to perform certain actions, the models still did. Accomplishments that we're proud of A fully client-side multiplayer : Each game feels different and you can influence the AI based on the messages you send While it is turn based speaking for the AI, it still feels natural as if the conversation is going by. What we learned LLM is fragile unless you give them structure + constraints . Designing multiplayer interactions between multiple Prompt API: I learnt about cloned sessions to provide different memory and persona. What's next for The Turing Werewolf Add new roles: Doctor, Seer. Voice chat mode (STT + TTS) for full immersion. Dynamic turn taking for the AI to decide when to speak
ang-rui-yan/the-turing-werewolf★ 00 forksJavaScriptMITCreated Oct 29, 2025 · last push Nov 1, 2025

README excerpt

# The Turing Werewolf

This is a submission for the Google Chrome Built‑in AI Challenge 2025. It’s a Vite + React project that uses Chrome’s Prompt API (Built‑in AI) to power NPC dialogue and behavior to simulate a Werewolf game.

## APIs used

- Prompt API: For different persona and actions to be taken by the different roles: Villager, Werewolf, Fool.
- Rewriter API: In order for the Player to be disguised under a neutral tone.

## Prerequisites

- Node.js 18+ (Node 20+ recommended)
- npm
- Desktop Google Chrome with Built‑in AI / Prompt API support
  - On first run, Chrome may download an on‑device language model. This can take a few minutes; the game may appear idle. Please be patient!

## Quick start

1. Install dependencies

```bash
npm install
```

2. Start the dev server

```bash
npm run dev
```

3. Open the app

Visit the URL Vite prints (typically http://localhost:5173). Use Chrome.

4. Start a game

- In the lobby, click the Start button (top‑right).
- Enter your name and click “Start Game”.
- NPCs may take a moment to initialize the first time the on‑device model is used.

## Build and preview

Create an optimized production build:

```bash
npm run build
```

Preview the production build locally:

```bash
npm run preview
```

## Scripts

- `npm run dev` — Start Vite dev server
- `npm run build` — Build for production
- `npm run preview` — Preview the production build
- `npm run lint` — Run ESLint

## Browser support

- Developed and tested on Desktop Chrome. Prompt

Team