v2026.6.1
All Bundles
Bundle Classic AI algorithms: graph search, adversarial game search, optimization and tabular reinforcement learning (-lib ai)

GameState

A two-player, zero-sum game position. Moves are integers chosen by the implementation (board cells, column ids, etc.). Evaluate scores the position from the MAXIMIZING player's perspective (positive = good for the maximizer); IsMaximizing reports whose turn it is.

Operations

Apply # virtual

Applies a move, producing the successor position.

method : public : virtual : Apply(move:Int) ~ System.AI.GameState

Parameters

NameTypeDescription
moveIntmove id

Return

TypeDescription
GameStatesuccessor state

Evaluate # virtual

Scores the position from the maximizing player's perspective.

method : public : virtual : Evaluate() ~ Float

Return

TypeDescription
Floatpositive = good for the maximizer

GetMoves # virtual

Gets the legal moves for the player to move.

method : public : virtual : GetMoves() ~ Int[]

Return

TypeDescription
Intmove ids (empty when terminal)

IsMaximizing # virtual

Whose turn it is.

method : public : virtual : IsMaximizing() ~ Bool

Return

TypeDescription
Booltrue when the maximizing player moves next

IsTerminal # virtual

Whether the game is over in this position.

method : public : virtual : IsTerminal() ~ Bool

Return

TypeDescription
Booltrue when terminal