How it works
Party Board
A property game for a room full of people, on one computer you pass around. The rules are a small state machine that runs in the page; there is no server, no account and nothing to install. Every word on the board lives in one file you can edit.
- State machines
- Game design
- Property testing
One turn
- Rolltwo dice, move, collect $200 for passing Start
- Landbuy it, or face its challenge, or a jar, card or hangout
- Judgethe table says nailed it or not quite
- Passbuild houses if you can, then hand the computer on
The rules as a state machine
One phase at a time
A whole game is one plain object: the players and their money and positions, who owns what and how many houses, the question jar, and the current turn. A turn is always in exactly one phase: hot seat, roll, buy, rent, judging, group activity, jar, wild card, or end. Each button sends an action, and web/engine.js accepts it only if it makes sense in the current phase. That's what makes a double-click or a button from a moment ago harmless.
The page never changes the game directly. It copies the game, asks the engine to apply the action to the copy, and only keeps the copy if the engine says yes.
function act(a) {
a.from = a.from || TABLE;
var s = clone(state);
if (!E.apply(s, a, { rng: Math.random, present: everyone() })) return false;
s.v++; state = s; save(); draw(); return true;
}- Work on a copy, so a refused action can't leave the game half-changed.
- The engine decides. The same code would run unchanged on a server or in a test.
- Keep it, save it to this tab's session storage (so a reload mid-game loses nothing), and redraw everything from it.
Challenges, judged by the table
Making the game about the people, not the money
Every property has three challenges, in one of six kinds: physical, quick thinking, getting to know you, doing it with another player, making something up, and performing. Landing on someone else's property draws one at random, with the owner's name or a random partner filled in.
The money is tuned so that trying is almost always worth it. Skipping costs the rent. Trying costs nothing if the table says you did it, and 1.5× rent if not. Houses only raise the rent, so a built-up property doesn't make the challenge harder, it makes chickening out expensive. The table judges, out loud, and whoever holds the computer taps the verdict.
function closeVote(s, auto, verdict) {
var t = s.turn, yes = 0, no = 0;
Object.keys(t.votes).forEach(function (id) { if (t.votes[id]) yes++; else no++; });
var p = byId(s, t.pid), passed = verdict !== undefined ? verdict : auto || yes >= no; // ties go to the player
if (verdict !== undefined) { yes = verdict ? 1 : 0; no = verdict ? 0 : 1; }
t.voteResult = { yes: yes, no: no, passed: passed };
if (passed) { t.note = p.name + " nailed it and pays no rent."; log(s, p.name + " passed the challenge on " + C.SPACES[t.landed].name + (verdict !== undefined ? "." : " (" + yes + "–" + no + ").")); }
else {
var amt = Math.round(t.rent * C.FAIL_MULT), paid = pay(s, p.id, amt, t.owner);
t.note = p.name + " didn't quite make it and paid " + name(s, t.owner) + " " + money(paid) + ".";
log(s, p.name + " failed the challenge on " + C.SPACES[t.landed].name + (verdict !== undefined ? "" : " (" + yes + "–" + no + ")") + " and paid " + money(paid) + ".");
}
t.phase = "end";- On one shared screen the table's verdict decides. (The same function can also count individual votes, which the rules still support.)
- Not quite: 1.5× rent, paid to the owner.
Hangouts get the whole table doing something together before the visitor pays. Question Jars draw a question someone at the table wrote and whoever answers gets $30. Wild Cards include thumb wars, staring contests and swapping places. The Hot Seat means everyone asks you one question before your next roll.
Nobody goes bankrupt
A party game where nobody sits out
In Monopoly, going broke means watching everyone else play for an hour. Here, every payment goes through one function. If you can't afford it, your houses and then your properties are sold back to the bank at half price until you can; if that still isn't enough, you pay what you have and the rest is written off. You carry on at $0.
// Sell houses (most expensive first), then properties (cheapest first), at half price, until `need` is covered.
function raise(s, p, need) {
while (p.cash < need) {
var best = null;
Object.keys(s.owners).forEach(function (k) {
var o = s.owners[k]; if (o.id !== p.id || !o.houses) return;
var c = C.SETS[C.SPACES[k].set].houseCost;
if (!best || c > best.c) best = { k: k, c: c };
});
if (best) { s.owners[best.k].houses--; p.cash += best.c / 2; log(s, p.name + " sold a house on " + C.SPACES[best.k].name + " for " + money(best.c / 2) + "."); continue; }
var cheap = null;
Object.keys(s.owners).forEach(function (k) {
if (s.owners[k].id !== p.id) return;
var c = priceOf(+k);
if (!cheap || c < cheap.c) cheap = { k: k, c: c };
});
if (!cheap) break;
delete s.owners[cheap.k]; p.cash += cheap.c / 2;
log(s, p.name + " sold " + C.SPACES[cheap.k].name + " back to the bank for " + money(cheap.c / 2) + ".");
}
} // Move money. from/to null means the bank. Returns how much actually changed hands.
function pay(s, fromId, amount, toId) {
amount = Math.round(amount);
if (amount <= 0) return 0;
var paid = amount;
if (fromId) {
var f = byId(s, fromId); if (!f) return 0;
if (f.cash < amount) raise(s, f, amount);
paid = Math.min(f.cash, amount);
f.cash -= paid;
if (paid < amount) log(s, f.name + " ran out of money. The bank wipes the rest of the debt.");
}
if (toId) { var t = byId(s, toId); if (t) t.cash += paid; }
return paid;
}- Houses go first, most expensive first, since they are the easiest thing to lose.
- Then properties, cheapest first.
- Never more than you have, so money can't go below zero.
Testing
What was checked, and how
- The rules, fuzzed. 60 random games of 2 to 12 bots, about 10,000 turns, with players leaving and joining mid-game in every phase. After every action: nobody's money is negative or not a number, every owner is still in the game, the turn belongs to a real player, houses stay within 0 to 3, and every game ends with a correct ranking. About 1.7 million checks.
- Specific cases. Rent and set doubling, house rents, selling off to pay a debt, the round limit, leaving on your own turn, duplicate pieces, the table's verdict and building on the current player's behalf.
- The page, in a real browser. Six players added, games of 20 and 30 turns played with clicks and the space bar, a reload in the middle of a game, and quitting back to the setup screen. No script errors.
Limits
What to say when someone asks
- One screen. Everyone sees the same computer, so the Question Jar isn't secret from people watching you type.
- Closing the tab ends the game. A reload keeps it; closing the tab or the browser doesn't.
- The table is the referee. Nothing checks whether you really held the plank.
- Up to 16 players. Past about 12 a round gets long.
Make it yours
Changing the challenges
Every word on the board lives in web/content.js: the 32 spaces, the three challenges on each property, the group activities, the wild cards and the starter questions. Change the text freely. {owner} becomes the owner's name and {partner} a random other player; add a number of seconds to a challenge to give it a timer button. Run node projects/party-board/tests/game.test.mjs afterwards to check nothing broke.
Read further
The files
- web/engine.js the rules, as pure functions over the game
- web/content.js the board and every challenge, card and question
- web/app.js the page: setup, board, buttons, results
- tests/game.test.mjs the fuzzed rules and specific cases