#ifndef CHESSY_MINIMAX_H #define CHESSY_MINIMAX_H #include "MoveGeneration.h" namespace chessy { class MiniMax; } class chessy::MiniMax { ChessGame& game; struct BestMove { Move move; float value; inline void overwriteIfBetter(BestMove other) { if (other.value > value) *this = other; } inline BestMove operator - (void) const { return { move, -value }; } }; public: inline MiniMax(ChessGame& game) : game{ game } {} Move calculateBest(int depth); template float evaluate(void) const; private: template BestMove minimax(int depth); }; #endif // CHESSY_MINIMAX_H