Turn‑Based Duel(Turn-based Duel)
Core of turn‑based combat: action rights and adjudication
You take one turn, they take one turn — race to the goal first. Tic-tac-toe, Gomoku, and chess are all built on this.
On your turn the board freezes and you can think as long as you like; once you place, the situation flips and the opponent answers instantly — every move wonders "what will they do next?"
It is the oldest and cleanest model of opposition — if you want to learn where strategic depth comes from, start with turn rights and adjudication.
Turn-based dueling breaks confrontation into discrete, explainable decision points: turn rights guarantee both sides express intent in alternation, legality checks keep the rule boundary crisp, and adjudication closes every match. The hard part is not the rules — it is the intelligence gradient of the opponent and the completeness of endings: the AI difficulty ladder IS the learning curve, and a missing draw branch means a match can never end. Players "lose without complaint" because every consequence traces back to one specific move.
Turn-based dueling satisfies the oldest intellectual competitiveness: no excuses about reflexes — the outcome lives entirely in your head. Losing feels fair; winning feels earned.
Turn-based opposition is the origin form of competitive socializing: the rules ARE the social protocol, and a board is a face-to-face connection that needs no network. From board games to card battlers, it remains the ecological bedrock of adversarial play — and the oldest testing ground for AI opponent design.
Learn turn-based duels and you learn discrete decision-point design — turn rights, legality, adjudication closure — a skeleton that extends directly to tactics games, deck-builders, and even asynchronous social duels.

- Beginner: understand the turn state machine (turn start → action → switch → adjudication) and reproduce a legal move plus a win judgment in the demo
- Intermediate: write the full legality-check and adjudication contract (including draw/full-board closure), and wire up a minimax AI
- Advanced: design the AI difficulty ladder and action-count rules (combos/cooldowns), and verify balance with match-length distribution and first-move win rate
② Instant Playable Demo
③ Behavior System Breakdown

- Use turn switching and phase machines to keep each side’s action rights clear and controllable.
- Use legality checks to turn rule boundaries into interpretable rejection feedback.
- Provide clear win/loss/draw adjudication to give each game a definitive conclusion.
- By limiting actions to one per turn, the pacing is balanced and prevents excessive combos that end the game too quickly. Allowing multiple actions lets players play several cards in a single turn, increasing strategic depth but potentially extending game duration.
- Choosing the line length N is a key trade‑off: too large makes players search longer for a connect, slowing the pace; too small makes connections easy, speeding the game. Experiments show N=5 on a 15×15 board offers the best balance.
- In card‑based turn systems, allowing multiple cards per action (combo) may seem to add complexity, but it lets players generate higher value through combinations, actually deepening the game rather than weakening it.
- Action rights: Each turn starts with the current player; after performing one action, control immediately switches to the opponent. The acting player may perform only one action per turn, and it counts as completed only after passing legality checks. Turn count starts at 1 and records the current player.
- Legality: The placement must be within the board and unoccupied; for card actions, the player must have sufficient cost and at least one card in hand; for special skills, cooldowns and resources must be satisfied. Illegal actions return error code "InvalidMove" with a reason.
- Adjudication: If either player forms a continuous N of identical symbols (horizontal, vertical, or diagonal), that player wins; if the board has no empty spaces and no connections, the game is a draw; if neither condition is met, the turn continues. The adjudication check runs immediately after each legal action.
④ Common Combos & Variants
⑤ Advanced Design & Algorithms (collapsed)Click to expand
- Missing legality checks can cause players to treat rule loopholes as bugs (or bugs as rules).
- Unadjustable AI difficulty can deter both beginners and veterans.
- Omitting draw conditions can leave games unresolved (full board/long play must be explicitly handled).
- Overly permissive adjudication rules make connections too easy, stripping strategic depth.
- Win/loss determination: N‑in‑a‑row scanning, comparison logic, and draw rules.
- AI: minimax with alpha‑beta pruning and a board evaluation function.
