Skip to content

alphaBetaSearch

alphaBetaSearch<S, M, P>(game, state, options): AlphaBetaResult<M>

Defined in: src/modules/game-search/alpha-beta.ts:101

Looks ahead with iterative-deepening minimax and alpha-beta pruning and returns the best move for the player to move in state.

It searches one move deeper each round until the budget runs out or the game tree is exhausted, and returns the best move of the last finished round. The first round always finishes, so a legal move comes back whenever one exists. Every other player is assumed to play against the root player, which also covers moves that leave the same player to move.

Throws when a budget option is negative or not a number.

S

M

P = number

SearchGame<S, M, P>

S

AlphaBetaOptions<S, P>

AlphaBetaResult<M>