Skip to content
Dan Riddell edited this page Aug 5, 2026 · 1 revision

Agents

An agent is a strategy that picks a move. Both sides are chosen independently with --white and --black, so any pairing is possible — including an agent against itself.

Built in

Name Description
random Picks uniformly at random from the legal moves
greedy Takes the best immediate material gain, no lookahead
minimax Alpha-beta search to a fixed depth (--depth)
iterative Iterative-deepening search, working up to --depth
beam Beam search — explores a bounded frontier rather than the full tree
mcts Monte Carlo tree search
human You. Click a piece then a destination; GUI build only

--depth applies to the depth-limited searchers. --seed seeds the stochastic ones, so random and mcts replay identically for a given seed.

Examples

# The default pairing
gambit --white minimax --black random

# Both sides search
gambit --white minimax --black minimax --depth 5

# Monte Carlo against iterative deepening
gambit --white mcts --black iterative

# Play white yourself, in the GUI build
just gui -- --white human --black minimax

Adding a strategy

Implement agent.Agent and call agent.Register from an init — the game loop and GUI need no changes.

Two board APIs are available depending on how your search works:

Method Use
Board.MakeMove / UnmakeMove In-place, for alpha-beta style search that unwinds
Board.ApplyMove Clone, for keeping many positions alive at once

The headless build batches games with no display, which is the practical way to evaluate a new strategy over many seeds.

Clone this wiki locally