Skip to main content
Formal Specification

Andrez (Cypriot Three/Nine Men's Morris) — Formal Specification

Cyprus · board-abstract · Confidence: low

← Back to game page

Implementation Suitability

Suitability: engine-readyFidelity: directGap-fills: 2
# Andrez — AI-optimized specification ## General idea A deterministic 2-player abstract alignment strategy game played on an unweighted undirected planar graph. Players alternate placing tokens onto graph vertices and subsequently sliding them along edges to form 3-in-a-row alignments (mills), capturing opponent pieces. ## Formal model - **Abstraction taken:** Direct representation. The board is represented as an undirected graph G=(V,E). - For 3-Man Andrez: |V|=9 (8 boundary vertices + 1 central vertex), with all orthogonal and diagonal mill lines defined. - For 9-Man Andrez: |V|=24 (three concentric 8-vertex squares connected at side midpoints). - **Player/agent count:** 2 agents (P1,P2). - **Turn model:** Strictly sequential alternating turns. P1 moves first. ## Formal rules R1. **State Space & Setup:** - Board occupancy 𝐛∈{0,1,2}|V|, initially 𝐛=𝟎. - Pieces in hand: h1=K,h2=K (where K=3 for 3-Man, K=9 for 9-Man). - Pieces on board: c1=0,c2=0. - Phase: Phase∈{PLACEMENT,MOVEMENT,FLYING}. R2. **Placement Phase:** - While hi>0, active player Pi executes `place(v)` on any v∈V such that b[v]==0. - Updates: b[v]←i, hi←hi−1, ci←ci+1. - If placing on v forms a new mill (a 3-vertex clique along a predefined line M⊂V with all vertices occupied by i): - In 3-Man: Pi immediately wins (game terminates). - In 9-Man: Pi executes `capture(u)` where b[u]==(3−i) and u is not part of an opponent mill (unless all opponent pieces are in mills). b[u]←0, c3−i←c3−i−1. - When h1==0 and h2==0, transition to MOVEMENT phase. R3. **Movement Phase:** - Active player Pi executes `move(u, v)` where b[u]==i, b[v]==0, and (u,v)∈E. - If Pi has ci==3 (and optional flying rule is enabled [gap-fill]), Pi may execute `fly(u, v)` to any vacant v∈V without edge adjacency constraint. - If the move completes a new mill, Pi executes `capture(w)` of an eligible opposing piece. R4. **Capture Legality:** - Piece w belonging to opponent can only be captured if w does not belong to a closed mill, unless all opposing pieces on board belong to mills. R5. **Win / Loss Conditions:** - Player Pi wins if opponent P3−i is reduced to c3−i<3 pieces on board (in 9-Man Andrez). - Player Pi wins if opponent P3−i has no legal moves on their turn. R6. [gap-fill] **Draw / Repetition Rule:** If the exact same board state and active player recurs 3 times (threefold repetition), or if 50 consecutive moves occur without a capture or mill creation, the game is declared a draw. ## Edge cases - **Tie at the end condition:** Handled by R6 (threefold repetition or 50-move limit without capture results in a draw). - **A player with no legal move:** If an active player in movement phase has no legal `move()` action, that player immediately loses (per R5). - **Repetition / cycles:** Explicitly broken by the threefold repetition and 50-move draw rule in R6. - **Simultaneous claims on the same resource or position:** Not applicable — strictly sequential turns on discrete graph vertices. - **Player elimination mid-round:** Not applicable — exactly 2 players; losing conditions terminate the match. - **Resource exhaustion:** Hand tokens decrement to 0 during placement; board pieces are invariant or decreasing via captures. - **Termination guarantee:** Guaranteed by state space finiteness and R6 (50-move rule and repetition draw bounds). ## State representation - **Persistent state:** Board vertex array b[1..|V|], hand counts (h1,h2), on-board counts (c1,c2), active player turn p∈{1,2}, phase indicator, history hash set for repetition detection, half-move counter since last capture. - **Observable information:** Perfect information — full board state is completely observed by both agents. ## Action space - `place(v)`: Place a hand piece on empty vertex v∈V (b[v]==0). - `move(u, v)`: Slide piece from u to adjacent empty vertex v ((u,v)∈E). - `fly(u, v)`: Move piece from u to any empty vertex v (valid only when ci==3). - `capture(w)`: Remove opponent piece from vertex w upon completing a mill. ## Playability notes - **Single-player-vs-AI:** Direct and standard. Solvable via minimax, alpha-beta pruning, or MCTS. - **Group games (n>4):** Not applicable — intrinsically a 2-player zero-sum abstract game. - **Physical-skill games:** Not applicable — zero physical dexterity required; pure combinatorial strategy. - **What is lost:** Nothing — formalization is a complete, lossless `direct` model. ## Implementation hints Graph representation via adjacency matrix or adjacency list. Precompute all collinear 3-tuples (mill sets) as bitmasks for O(1) mill detection. State evaluation can prioritize piece count, formed mills, blocked opposing pieces, and potential double-mill traps. First milestone: implement 3-Man Andrez with full minimax before expanding to 24-vertex 9-Man graph.

Download as JSON

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

Download JSON
Cite this page

Andrez (Cypriot Three/Nine Men's Morris) (Cyprus). (n.d.). Games of Countries. https://gamesofcountries.com/games/cy-cyprus/andrez

@misc{gamesofcountries-cy-cyprus-andrez,
  title = {Andrez (Cypriot Three/Nine Men's Morris) (Cyprus)},
  year = {n.d.},
  publisher = {Games of Countries},
  url = {https://gamesofcountries.com/games/cy-cyprus/andrez}
}