Skip to main content
Formal Specification

King of the Gates — Formal Specification

Bulgaria · singing-circle · Confidence: medium

← Back to game page

Implementation Suitability

Suitability: engine-readyFidelity: discretizedGap-fills: 3
# Kralyo portalyo — AI-optimized specification ## General idea A two-phase team-formation and strength-contest game. In Phase 1, marching agents pass through a binary capture gate whose timing is synchronized to a discrete lyrical step counter; captured agents make blind binary choices over hidden leader attributes to partition into two teams. In Phase 2, the game resolves as a deterministic or force-differential tug-of-war between the formed factions. ## Formal model - **Abstraction taken:** The continuous marching circle and song cadence are discretized into a sequence of L lyrical ticks per cycle (L=16). The physical tug-of-war is modeled as an aggregate pulling-force differential across a 1D positional axis. - **Player/agent count:** N=M+2, with 2 designated Leader agents (L0,L1) and M Marcher agents (M≥4). - **Turn model:** Synchronous stepped queue processing in Phase 1; simultaneous force commitment in Phase 2. ## Formal rules R1. Setup: Agents L0 and L1 are designated as gatekeepers. L0 secretly selects token W0∈{0,1}, and L1 receives W1=1−W0. R2. Marcher queue: Marchers are indexed in queue Q=[A1,A2,…,AM]. R3. Marching cycle: - [gap-fill] The lyrical song comprises L discrete steps. At each step t∈[1,L], the front agent of Q advances through the gate coordinate xgate=0, and the queue rotates circularly. - At tick t=L, the agent currently occupying xgate (denoted Atrapped) is captured and popped from Q. R4. Team assignment (Blind selection): - Atrapped receives a query to choose symbol c∈{0,1} without knowledge of the mapping Li→Wi. - If c==W0, Atrapped is appended to Team 0 (T0); otherwise, Atrapped is appended to Team 1 (T1). R5. Repeat R3–R4 until |Q|==0, resulting in complete partitioning T0∪T1={A1,…,AM}. R6. Phase 2 Setup (Tug-of-War): - Boundary mark is at coordinate x=0. Anchor L0 starts at x=−1, anchor L1 starts at x=+1. - Each agent i has an intrinsic strength parameter Fi>0. - Team pulling capacities are P0=FL0+∑i∈T0Fi and P1=FL1+∑i∈T1Fi. R7. Tug-of-war resolution: - [gap-fill] At each tug tick τ, the position shifts by Δx=α⋅(P1−P0), where α is a positive friction constant. - If x(τ)≤−Xwin, Team 0 wins. - If x(τ)≥+Xwin, Team 1 wins. - [gap-fill] If P0==P1, the team with the higher number of recruited members wins; if team counts are also equal, a coin toss decides the winner. ## Edge cases - Tie at the end condition: Fully resolved by R7 tiebreaking hierarchy (P0≠P1→|T0|≠|T1|→random flip). - A player with no legal move: Not applicable — queue progression is deterministic, choice c∈{0,1} is always available, and pulling force is automatically aggregated. - Repetition / cycles: Bounded: |Q| decreases by exactly 1 every L ticks in Phase 1, guaranteeing Phase 1 ends in exactly M×L ticks. Phase 2 terminates within finite ticks due to constant non-zero net force Δx. - Simultaneous claims on the same resource or position: Queue position is strictly sequential; exactly one agent occupies xgate at tick L. - Player elimination mid-round; turn order repair: If an agent disconnects during Phase 1, they are removed from Q without disrupting queue order; if in Phase 2, their Fi contribution is subtracted from team total. - Resource exhaustion: Not applicable — tokens {0,1} and queue slots are finite and strictly conserved. - Termination guarantee: Strict monotonic reduction of |Q| to 0 in Phase 1, followed by bounded linear displacement in Phase 2. ## State representation - Persistent state: Leader identities (L0,L1), secret mapping (W0,W1), team rosters T0,T1, agent strengths F1..N. - Per-tick ephemeral state: Queue state Q, song tick t∈[1,L], gate position displacement x(τ). - Observable information: Queue order, song progress, and team rosters are public; the mapping Li→Wi is private to leaders until Phase 1 concludes. ## Action space - `assign_secret_tokens(w0)`: Precondition: Leader L0 at game initialization. - `advance_march_step()`: Synchronous queue tick executed by game engine. - `choose_symbol(choice)`: Precondition: Caller is Atrapped at t=L, choice∈{0,1}. - `commit_pull_effort(effort_scalar)`: Precondition: Phase 2 active, effort ∈[0.0,1.0]. ## Playability notes - Single-player-vs-AI: Natural — Human plays as a marching agent (making the blind choice) or as a leader (assigning tokens and pulling in Phase 2). - Group games (n>4): Reduced to 2 agents (L0 vs L1) by auto-populating Q with simulated agents or drafting pre-assigned strength cards. - Physical-skill games: No fine motor skills required; the game is primarily social drafting and aggregate strength comparison. - What is lost: The physical tactile sensation of holding hands in an arch and the communal singing rhythm are abstracted into discrete counters. ## Implementation hints Extremely simple and robust state machine. Phase 1 is a deterministic circular buffer with M pop events; Phase 2 is a single scalar differential. Suggested first milestone: implement the complete two-phase state machine with uniform random marchers before adding agent-specific strategic drafting heuristics.

Download as JSON

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

Download JSON
Cite this page

King of the Gates (Bulgaria). (n.d.). Games of Countries. https://gamesofcountries.com/games/bg-bulgaria/kralyo-portalyo

@misc{gamesofcountries-bg-bulgaria-kralyo-portalyo,
  title = {King of the Gates (Bulgaria)},
  year = {n.d.},
  publisher = {Games of Countries},
  url = {https://gamesofcountries.com/games/bg-bulgaria/kralyo-portalyo}
}