Social deduction with hidden roles, playable in the browser by passing a phone: a role engine, night and day phases, and endings where the village or the wolves don't always win.

01
The Wolf is the big game of the Lab: social deduction with hidden roles. At night the wolves hunt and the special roles act; by day the village debates and votes on who to lynch. All by passing a single phone, with nothing to install.
If The Impostor was the minimal loop, The Wolf was the real test: a game with actual state that has to stay coherent round after round.
02
Here dealing cards falls short. There are six roles, night actions that resolve in a set order (the wolves kill, the priest protects, the seer reads), and wins that go beyond "the village wins or the wolves win": the Joker wins if he's lynched and the Spiteful one if his enemy is lynched.
All that logic is the heart of the game. Writing it tangled with the interface was a recipe for the same old subtle bugs: a role acting out of turn, a win that doesn't fire when it should.
03
I separated the engine from the screen. The logic lives in a module of pure functions in TypeScript: assign roles, resolve the night and check for a win, without touching any of the interface. That way it can be tested on its own and behaves the same every time.
On top, the screen only orchestrates the pass-the-phone game: dealing the roles in secret, the sequence of night actions, the dawn and the vote. The engine decides; the interface tells the story.
04
Pure functions for the game logic: predictable, testable and easy to reason about. The priest's protection lasts one night, the victim dies unless they're saved, and solo wins (Joker, Spiteful) take priority over team wins.
Toggleable roles and a random mode in the setup, so each group builds the game to taste: more wolves, with or without a seer, with or without wild cards.
05
A full game of social deduction in the browser, with its six roles, its night and day phases and its special endings, on a single phone that goes around.
Like the rest of the Lab, the game is brand content: it lives in /lab with the same editorial aesthetics and passes the same quality gate (typecheck, lint, tokens, build and tests) before every change. It works in Spanish and English depending on the site's language.
6
roles with their own logic
06
When the logic is the product, separate it from the screen. The pure engine is what made bringing complex rules to the browser boring in the good sense: no surprises, every ending fires when it should.
Reusing what I'd already validated in The Impostor (passing the phone, editorial aesthetics, the same quality gate) made the hard game cost far less than it looked.
From the Lab
It's not a demo or a video: it's the project running on this very site. Open it and play.
Now that you've seen a bit of how I work, tell me about yours: let's treat brand, product and code as one system.
Let's talk about your project