Classic Mode · Reference
Classic Per-Turn Mode
Classic mode launches a fresh process on each move to output one action, suited for single-file course assignments and round-robin tournaments. For persistent search trees, neural nets, or pondering, use Agent Arena.
1. Quick start
- Open Classic Games and pick a game.
- In the online editor, choose Python, C, C++, or Java — it preloads a runnable template.
- Implement play_games(step): read the board via read_ckbd(step - 1) and print one legal move via save_decision(...).
- Submit and battle preset bots, classmates, or your own past submissions.
Important:
Only emit your move to stdout (via save_decision). Any extra print() on stdout will corrupt the move parser — always print debug logs to stderr.
2. How each turn runs & player API
Your code compiles once at the start of a match, then launches fresh on each move — globals in memory do NOT persist between turns. Odd turns are Player A (1); even turns are Player B (2). Every match plays two legs (swapping who goes first).
read_ckbd(step - 1):reads the current board (placement games return board; movement games return playerA, playerB, board).save_decision(...):emits your move — (row, col) for placement games, or (from_r, from_c, to_r, to_c) for movement games.
import random, sys
from battle_base import read_ckbd, save_decision
def play_games(step: int) -> None:
_, _, board = read_ckbd(step - 1)
me = 1 if step % 2 == 1 else 2
moves = legal_moves(board, me)
if not moves:
save_decision(0, 0, 0, 0)
return
fx, fy, tx, ty = random.choice(moves)
print(f"turn {step}: ({fx},{fy}) -> ({tx},{ty})", file=sys.stderr)
save_decision(fx, fy, tx, ty)3. Limits, Elo & Tournaments
| Item | Typical default | Notes |
|---|---|---|
| Time per move | 2000 ms | Capped at 15000 ms; exceeding forfeits (TLE). |
| Memory per move | 64 MiB | Capped at 512 MiB (Java gets a higher floor). |
| Output cap | ~10 KB | Keep stdout strictly to save_decision. |
| Tournaments | 3 / 1 / 0 | Round-robin two-leg league using each entrant’s latest submission at deadline; separate from Elo. |