Formal Specification
Five in a Row (Tic-Tac-Toe on Squared Paper) — Formal Specification
Czechia · board-abstract · Confidence: low
← Back to game pageImplementation Suitability
Suitability: engine-readyFidelity: directGap-fills: 3
# Piškvorky — AI-optimized specification
## General idea
A perfect-information, zero-sum abstract strategy game played on a bounded 2D square grid. Two players take strictly alternating turns placing their unique symbol ( and ) on unoccupied intersections/cells. The objective is to achieve an unbroken contiguous orthogonal or diagonal alignment of exactly 5 symbols before the opponent does.
## Formal model
- **Abstraction taken:** None required (`fidelity_class: direct`). Traditional rules already constitute a discrete formal board game.
- **Player/agent count:** 2 players ().
- **Turn model:** Strictly sequential alternating turns. moves first.
## Formal rules
R1. Board: A discrete 2D grid where in standard tournament play (or in large grid format). Each cell . All cells are initialized to .
R2. On turn , active player selects one cell satisfying .
R3. The chosen cell is updated: . Placed symbols cannot be modified, removed, or relocated.
R4. Victory Check: After placing a symbol at , the engine checks all 4 line directions passing through (Horizontal, Vertical, Main Diagonal, Anti-Diagonal).
- If there exists a contiguous sequence of identical symbols of , wins immediately, and the game terminates.
R5. [gap-fill] Overline Rule: In standard freestyle Czech rules (*volné piškvorky*), a sequence of (including 6, 7, etc.) is a valid win.
R6. Draw Condition: If all cells are filled () without either player forming a 5-in-a-row, the game terminates in a draw.
R7. [gap-fill] Move Timer: In competitive agent play, an agent must submit an action within seconds. If the timer expires without a move, the active player forfeits by timeout.
R8. [gap-fill] Opening Protocol: In competitive matches, Swap2 opening protocol is applied to eliminate first-player theoretical winning advantage: places 3 stones; chooses to play White, play Black, or place 2 more stones and let choose color.
## Edge cases
- Tie at the end condition: The game terminates in a draw if and only if all grid cells are filled with no winning line achieved.
- A player with no legal move: If all cells are filled, R6 triggers a draw immediately; otherwise, there exists at least one legal cell.
- Repetition / cycles: Impossible by construction; each turn monotonically strictly reduces the count of cells from down toward 0.
- Simultaneous claims on the same resource or position: Turns are strictly alternating and sequential; cell legality requires .
- Player elimination mid-round: Not applicable; 2-player zero-sum game ending on first win, draw, or forfeit.
- Resource exhaustion: Monotonically bounded by the grid capacity.
- Termination guarantee: Trivially guaranteed since the game lasts at most moves (at most 225 moves on a board).
## State representation
- Persistent state: Grid dimension (default 15), active opening variant (Freestyle / Swap2).
- Per-turn ephemeral state: Board matrix , active player index , move history list , move count .
- Observable information: Full information game. Both players have complete, instantaneous visibility of the entire board state and move history.
## Action space
- `place(r, c)`: Place symbol at coordinate , where , with precondition .
## Playability notes
- Single-player-vs-AI: Fully natural and standard. Minimax with alpha-beta pruning, threat-space search (VCF / VCT algorithms), or Monte Carlo Tree Search (MCTS) provide superhuman benchmark AI.
- Group games (n>4): Not applicable; strictly a 2-player abstract game. Multi-player formats run as standard Swiss or double-elimination tournament brackets.
- Physical-skill games: Purely cognitive/combinatorial abstract game; zero physical skill abstraction needed.
- What is lost: The tactile experience of drawing crosses and circles in blue and red ink in the margins of a paper notebook.
## Implementation hints
Branching factor starts at on move 1 and decreases by 1 each turn. Strategic branching can be pruned dramatically by evaluating only candidate moves adjacent (within Chebyshev distance 2) to existing stones. Efficient line evaluation using bitboards or incremental direction array counters yields millions of nodes per second in alpha-beta engines. First milestone: implement board state, legal move validation, incremental 5-in-a-row victory detection, and basic greedy heuristic AI.
Download as JSON
Download the full game corpus entry for this game as structured JSON.
Download JSONCite this page
Piškvorky (Czechia). (n.d.). Games of Countries. https://gamesofcountries.com/games/cz-czechia/piskvorky
@misc{gamesofcountries-cz-czechia-piskvorky,
title = {Piškvorky (Czechia)},
year = {n.d.},
publisher = {Games of Countries},
url = {https://gamesofcountries.com/games/cz-czechia/piskvorky}
}