Formal Specification
King of the Gates — Formal Specification
Bulgaria · singing-circle · Confidence: medium
← Back to game pageImplementation 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 lyrical ticks per cycle (). The physical tug-of-war is modeled as an aggregate pulling-force differential across a 1D positional axis.
- **Player/agent count:** , with 2 designated Leader agents () and Marcher agents ().
- **Turn model:** Synchronous stepped queue processing in Phase 1; simultaneous force commitment in Phase 2.
## Formal rules
R1. Setup: Agents and are designated as gatekeepers. secretly selects token , and receives .
R2. Marcher queue: Marchers are indexed in queue .
R3. Marching cycle:
- [gap-fill] The lyrical song comprises discrete steps. At each step , the front agent of advances through the gate coordinate , and the queue rotates circularly.
- At tick , the agent currently occupying (denoted ) is captured and popped from .
R4. Team assignment (Blind selection):
- receives a query to choose symbol without knowledge of the mapping .
- If , is appended to Team 0 (); otherwise, is appended to Team 1 ().
R5. Repeat R3–R4 until , resulting in complete partitioning .
R6. Phase 2 Setup (Tug-of-War):
- Boundary mark is at coordinate . Anchor starts at , anchor starts at .
- Each agent has an intrinsic strength parameter .
- Team pulling capacities are and .
R7. Tug-of-war resolution:
- [gap-fill] At each tug tick , the position shifts by , where is a positive friction constant.
- If , Team 0 wins.
- If , Team 1 wins.
- [gap-fill] If , 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 ().
- A player with no legal move: Not applicable — queue progression is deterministic, choice is always available, and pulling force is automatically aggregated.
- Repetition / cycles: Bounded: decreases by exactly 1 every ticks in Phase 1, guaranteeing Phase 1 ends in exactly ticks. Phase 2 terminates within finite ticks due to constant non-zero net force .
- Simultaneous claims on the same resource or position: Queue position is strictly sequential; exactly one agent occupies at tick .
- Player elimination mid-round; turn order repair: If an agent disconnects during Phase 1, they are removed from without disrupting queue order; if in Phase 2, their contribution is subtracted from team total.
- Resource exhaustion: Not applicable — tokens and queue slots are finite and strictly conserved.
- Termination guarantee: Strict monotonic reduction of to 0 in Phase 1, followed by bounded linear displacement in Phase 2.
## State representation
- Persistent state: Leader identities , secret mapping , team rosters , agent strengths .
- Per-tick ephemeral state: Queue state , song tick , gate position displacement .
- Observable information: Queue order, song progress, and team rosters are public; the mapping is private to leaders until Phase 1 concludes.
## Action space
- `assign_secret_tokens(w0)`: Precondition: Leader at game initialization.
- `advance_march_step()`: Synchronous queue tick executed by game engine.
- `choose_symbol(choice)`: Precondition: Caller is at , .
- `commit_pull_effort(effort_scalar)`: Precondition: Phase 2 active, effort .
## 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 ( vs ) by auto-populating 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 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 JSONCite 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}
}