Skip to content

API Reference

Trent M. Wyatt edited this page Apr 23, 2025 · 1 revision

API Reference

template<
    typename GameState,
    typename Move,
    int MaxMoves,
    int MaxDepth = 8>
class Minimax;

Public Methods

Method Description
Move findBestMove(const GameState& state) Returns the optimal move up to MaxDepth.
int getBestScore() const Score from last search.
int getNodesSearched() const Node count from last search.

Nested Class GameLogic

Derive from this and override all five pure virtuals:

    class GameLogic {
      public:
        virtual int  evaluate(const GameState&) = 0;
        virtual int  generateMoves(const GameState&, Move[], int max) = 0;
        virtual void applyMove(GameState&, const Move&) = 0;
        virtual bool isTerminal(const GameState&) = 0;
        virtual bool isMaximizingPlayer(const GameState&) = 0;
    };

Tip: Use constexpr values inside your Board type to avoid globals.

Clone this wiki locally