Skip to main content
Formal Specification

Snake Eats Its Tail — Formal Specification

Thailand · chase-tag · Confidence: low

← Back to game page

Implementation Suitability

Suitability: engine-readyFidelity: discretizedGap-fills: 5
# Ngu Kin Hang — AI-optimized specification ## General idea A classic Thai line-tagging and dramatic chase game. One player acts as the "Father Snake" (*Pho Ngu*), who attempts to tag and "eat" the rearmost child of a single-file snake chain protected by the "Mother Snake" (*Mae Ngu*). Following an antiphonal sung dialogue describing sacred water wells, the Father Snake sprints left and right trying to flank the Mother Snake's blocking arms to capture the tail child. ## Formal model - **Abstraction taken:** The continuous spatial maneuvering of the single-file snake line is discretized into a 2D radial sector arena centered on the Mother Snake. The arena consists of 12 angular sectors (`0` to `11`, arranged cyclically). The Mother Snake projects a blocking barrier covering 3 contiguous sectors; the children form a kinematic tail chain extending opposite her facing direction. - **Player/agent count:** 1 Father Snake agent vs `1 + K` defending agents (1 Mother Snake controller + `K` Child Snakes in a chain, where `K in [3, 10]`). - **Turn model:** Simultaneous action selection per movement tick during the chase phase. ## Formal rules R1. Setup: The arena is divided into 12 angular sectors `[0..11]`. Mother Snake (*Mae Ngu*) occupies the origin `(0, 0)` facing sector 0. Child Snakes (*Luk Ngu*) form a connected chain of length `K` trailing behind her in sector 6. Father Snake (*Pho Ngu*) starts 3 units away in sector 0. R2. [gap-fill] Litany Phase: At the start of each capture round, the antiphonal dialogue is executed (a fixed 3-step sequence of verse inquiries). This resets agent positions and establishes the active chain length `K`. R3. [gap-fill] Chase Phase Actions (per tick): - *Pho Ngu* selects: `Shift_Sector(dir)` where `dir in {-2, -1, 0, 1, 2}` or `Lunge_Tag(sector)`. - *Mae Ngu* selects: `Rotate_Block(dir)` where `dir in {-1, 0, 1}` to re-orient her 3-sector defensive shield `[facing - 1, facing, facing + 1] mod 12`. - [gap-fill] Tail Kinematics: The children chain follows Mother Snake's movement with a 1-tick delay per segment. Rapid rotations cause the tail end (segment `K`) to swing outward, occupying sectors outside Mother Snake's direct shielding arc. R4. [gap-fill] Tagging & Elimination: - If *Pho Ngu* executes `Lunge_Tag(sector)` targeting the exact sector currently occupied by the tail child (segment `K`), AND that sector is NOT covered by *Mae Ngu*'s defensive block, the tail child is tagged ("eaten"). - The eaten child is eliminated from the chain (`K = K - 1`). The round ends immediately, and play loops back to the Litany Phase (R2). - If *Pho Ngu* lunges into a sector blocked by *Mae Ngu*, the tag fails, and *Pho Ngu* incurs a 1-tick stun (cannot move next tick). R5. [gap-fill] Round Cap & Match End: - Each chase phase has a maximum duration of 25 ticks. If *Pho Ngu* fails to capture a child within 25 ticks, the round resets to R2 without an elimination. - Match Ends when either: 1. All `K` children are eaten (`K == 0`): Father Snake wins. 2. 5 chase rounds elapse with at least 1 child remaining: Mother Snake team wins. ## Edge cases - Tie at the end condition: If 5 full chase rounds elapse with at least 1 child remaining, the Mother Snake team wins by defense; if all children are eaten, Father Snake wins. No tie is possible. - A player with no legal move: Not applicable; Father Snake always has movement/lunge actions, and Mother Snake always has rotation/blocking actions. - Repetition / cycles: Bounded by the 25-tick limit per chase round and the 5-round match cap. - Simultaneous claims on the same resource or position: Father Snake cannot enter the origin occupied by Mother Snake; collisions at the blocking boundary resolve as a blocked lunge. - Player elimination mid-round; turn order repair: When the tail child is tagged, they are removed from the chain; the chain length decreases by 1 (`K = K - 1`), and the new tail is the preceding child; all agents reset for the next litany. - Resource exhaustion: Child count `K` is strictly bounded and decrements on each successful tag. - Termination guarantee: why the game provably ends: Guaranteed by the hard cap of 5 chase rounds of 25 ticks each (maximum 125 ticks total match duration). ## State representation - Persistent state: - `active_children_count`: integer `K` in `[0, K_initial]` - `round_number`: integer in `[1, 5]` - `match_status`: `litany | chasing | father_win | mother_win` - Per-turn ephemeral state: - `father_sector`: integer in `[0, 11]` - `mother_facing`: integer in `[0, 11]` - `child_sectors[K]`: array of sector coordinates for each child segment - `chase_tick`: integer in `[0, 25]` - Observable information: Fully observable public state (all positions, chain segments, facing angles, and round counts are visible to all agents). ## Action space - Father Snake (*Pho Ngu*): - `shift_clockwise(steps)`: Move 1 or 2 sectors clockwise around the perimeter. - `shift_counter_clockwise(steps)`: Move 1 or 2 sectors counter-clockwise. - `lunge_tag(sector)`: Strike into designated sector to capture tail child. - Mother Snake (*Mae Ngu*): - `rotate_clockwise()`: Turn facing 1 sector clockwise, shifting 3-sector shield. - `rotate_counter_clockwise()`: Turn facing 1 sector counter-clockwise. - `hold_facing()`: Maintain current shield orientation. ## Playability notes - Single-player-vs-AI: Excellent 1v1 asymmetric dynamic; human can control Father Snake (feinting and flanking) against AI Mother Snake (shield tracking and tail control), or vice-versa. - Group games (n>4): The multi-child chain can be controlled as a single kinematic entity by the Mother Snake agent, or each child agent can make slight independent balance/grip retention inputs. - Physical-skill games: Physical body blocking, human chain momentum, and lateral sprinting are modeled via radial sector kinematics and shielding coverage. - What is lost in the adaptation: The theatrical singing of the Sorrow, Sand, and Stone wells (*"Kin nam bo sok? Yok pai ko yok ma!"*), the tactile grip on friends' waists, and collective shrieks during near-misses. ## Implementation hints - Discrete 12-sector circular array with standard modular arithmetic (`% 12`). - Model the child chain as a FIFO queue of previous Mother Snake positions to create natural rotational inertia and tail whip. - Suggested first milestone: Implement the 12-sector chase arena with the 1-tick delay queue for the tail and verify lunge vs block conflict logic.

Download as JSON

Download the full game corpus entry for this game as structured JSON.

Download JSON
Cite this page

Snake Eats Its Tail (Thailand). (n.d.). Games of Countries. https://gamesofcountries.com/games/th-thailand/ngu-kin-hang

@misc{gamesofcountries-th-thailand-ngu-kin-hang,
  title = {Snake Eats Its Tail (Thailand)},
  year = {n.d.},
  publisher = {Games of Countries},
  url = {https://gamesofcountries.com/games/th-thailand/ngu-kin-hang}
}