← SPL reference

game (built-in)

Tic-tac-toe minimax helper. Always available as game.ticBestMove — no use required. Optional use tic_ai; loads lib/tic_ai.py, a thin shim that re-registers the same API for demos.

API

#comment: board is a length-9 list; empty cells are "" (or your empty marker);
#comment: ai / hu are the marks for the computer and human (e.g. "X", "O");
move.setVar(game.ticBestMove(board, "O", "X"));
print.number(move);

Full interactive example: examples/tic_tac_toe.spl.

Implementation: interpreter game namespace; optional lib/tic_ai.py