Origo Party
README.md
game.rules — Origo Party's shared contract
The one module every slice of Origo Party reads. It holds no mutable state:
the Match component owns the live state table and publishes it as
Rules.state, and every other slice reads that and listens on Rules.on.
Constants
ROUNDS (3), START_COINS (10), STAR_COST (20), BLUE_COINS (3),
RED_COINS (-3), SHOWDOWN_SECONDS (60), SHOWDOWN_BONUS (10), and
PLAYERS — the four seats with their colour, candy material and whether the
seat is human.
The board
BOARD_SIZE (32) tiles around a superellipse RADIUS_X x RADIUS_Z.
tilePosition(index) -> x, y, z— where tileindex(1..32) sits.tileFacing(index)— the heading a pawn faces standing on it.pawnPosition(index, seat)— beside the tile, fanned by seat so four pawns on one tile do not overlap.spaceKindAt(index, round)->"blue" | "red" | "green" | "shop" | "star". The Star Space moves every round;starIndexForRound(round)names it.SPACE_MATERIAL/SPACE_LABEL— what each kind looks like and reads as.
The rules
advance(from, spaces)— the tile you land on, wrapping the loop.resolveSpace(kind, player, rng)->{ coins, stars, kind, note }.rankings(players)— final order, stars first then coins.newState(rounds)— the shape the Match component owns.
The bus
Rules.on(event, fn) returns an unsubscribe. Rules.emit(event, payload).
A handler that throws is dropped and logged; it never takes the bus down.
Events: title, roundStart, turnStart, roll, moveStep, arrive,
resolve, shop, starBought, roundEnd, showdownStart, showdownScore,
showdownEnd, matchEnd, hud.