Formal Specification
Sifting the Rice — Formal Specification
Thailand · singing-circle · Confidence: low
← Back to game pageImplementation Suitability
Suitability: engine-readyFidelity: discretizedGap-fills: 4
# Ree Ree Khao San — AI-optimized specification
## General idea
A traditional Thai arch-gate passing game where two gate-keepers form a raised arm arch while a single-file line of players weaves underneath to a rhythmic verse describing unhusked rice measuring. On the final syllable of the song, the gate-keepers drop their arms to trap the passing player, who is either eliminated (in individual survival mode) or recruited into one of two teams for a concluding tug-of-war.
## Formal model
- **Abstraction taken:** The continuous line march under the arch is discretized into a single-file queue of positions `{0, 1, ..., K-1}` advancing along a 1D loop of track slots. The song represents a fixed discrete timer of `T = 16` rhythm beats. Walkers choose stepping tempos; whoever occupies the gate slot at beat 16 is captured.
- **Player/agent count:** 2 Gate-keepers (operating jointly) + `K` Line Walkers (`K in [4, 12]`).
- **Turn model:** Synchronous discrete beat updates during the chant loop.
## Formal rules
R1. Setup:
- The arch is positioned at track slot `G = 0` along a cyclic track of length `L = K + 4`.
- `K` Line Walkers are arranged in single-file order occupying track slots `[1, K]`.
- Song duration is fixed at `T = 16` beats per verse.
R2. [gap-fill] Stepping & Pacing Mechanics (per beat `t in [1..16]`):
- On each beat, each active walker in the line chooses a pace:
- `Normal_Step`: Advance 1 track slot.
- `Hesitate`: Advance 0 slots (holding back to avoid gate), only legal if not blocked by the child behind.
- `Hustle`: Advance 2 track slots (pushing through gate), consumes 5 stamina.
- Single-file constraint: A player cannot pass through or overtake the player immediately in front; if a desired step causes a collision, the player's movement is clamped to the slot directly behind the leader.
R3. [gap-fill] Gate Closure & Capture:
- At beat `t = 16` (the final syllable *"Wai!"*), the gate-keepers drop their arms to lock slot `G = 0`.
- The player occupying slot `0` at beat 16 is captured.
- If slot `0` is unoccupied at beat 16, the player closest to slot `0` from the entry side is trapped.
R4. [gap-fill] Resolution Modes:
- **Mode 1 (Elimination / Survival):** The captured player is eliminated from the line. The line reforms with length `K - 1`. The last remaining uncaught player wins.
- **Mode 2 (Team Division & Tug-of-War):** The two gate-keepers secretly hold codewords A ("Lotus") and B ("Jasmine"). The captured player chooses A or B and joins that gate-keeper's team. Once all `K` players are assigned, the two teams resolve the match via a discrete tug-of-war strength contest: `Team_Strength = Sum(Player_Stamina)`.
R5. [gap-fill] Verse Progression:
- Each verse iteration strictly reduces the active line size `K` by 1.
- Exactly `K - 1` verses are executed in Mode 1 (or `K` verses in Mode 2) to complete the game.
## Edge cases
- Tie at the end condition: In Mode 1 (Elimination), the single last survivor wins unambiguously. In Mode 2 (Tug-of-War), if both teams have identical aggregate strength, the match is declared a draw (*Samoe*).
- A player with no legal move: Not applicable; walkers always have valid stepping actions bounded by single-file spacing.
- Repetition / cycles: Bounded by the monotonic reduction of the line size `K` by exactly 1 player per verse.
- Simultaneous claims on the same resource or position: Track slots have single occupancy; single-file order prevents overlap.
- Player elimination mid-round; turn order repair: When a player is captured, they are removed from the queue; the queue index list closes the gap (`line_length = line_length - 1`), and the next verse begins at beat `t = 1`.
- Resource exhaustion: The line of players `K` is strictly finite and decrements to 1 (or 0).
- Termination guarantee: why the game provably ends: Exactly `K - 1` verses of 16 beats each are executed, guaranteeing termination in `16 * (K - 1)` discrete beats.
## State representation
- Persistent state:
- `game_mode`: `elimination | tug_of_war`
- `active_line_length`: integer `K`
- `team_A_roster`: list of player IDs (in Mode 2)
- `team_B_roster`: list of player IDs (in Mode 2)
- `player_stamina[K]`: integer array
- Per-turn ephemeral state:
- `beat_counter`: integer in `[1, 16]`
- `walker_positions[K]`: integer array of slot coordinates on the track
- `captured_player_this_verse`: `null | player_id`
- Observable information: Fully observable public state (all walker positions, active beat count, and team assignments are visible to all agents).
## Action space
- Line Walker:
- `normal_step()`: Advance 1 slot.
- `hesitate()`: Advance 0 slots.
- `hustle()`: Advance 2 slots (costs stamina).
- `choose_team(codeword)`: `codeword in {A, B}` (used upon capture in Mode 2).
- Gate-keepers:
- `drop_gate()`: Automatic execution at beat 16.
## Playability notes
- Single-player-vs-AI: Playable as a timing/pacing optimization game where the player seeks to avoid being in slot 0 at beat 16 despite front-line congestion and braking.
- Group games (n>4): Natively accommodates 6 to 20 players; multiplayer queuing dynamics emerge naturally from single-file congestion.
- Physical-skill games: Rhythmic stepping, visual timing, and line momentum are formalized through discrete beat pacing choices and collision clamping.
- What is lost in the adaptation: The communal singing of the iconic Thai rhyme (*"Ree ree khao san, song thanan khao plueak..."*) and the physical excitement of dodging under lowered arms.
## Implementation hints
- Implement the line as a 1D integer coordinate array with simple non-passing collision constraints (`pos[i] < pos[i-1]`).
- Suggested first milestone: Implement the 16-beat stepping loop with single-file physics and verify that exactly one player is trapped at beat 16 per verse.
Download as JSON
Download the full game corpus entry for this game as structured JSON.
Download JSONCite this page
Sifting the Rice (Thailand). (n.d.). Games of Countries. https://gamesofcountries.com/games/th-thailand/ree-ree-khao-san
@misc{gamesofcountries-th-thailand-ree-ree-khao-san,
title = {Sifting the Rice (Thailand)},
year = {n.d.},
publisher = {Games of Countries},
url = {https://gamesofcountries.com/games/th-thailand/ree-ree-khao-san}
}