123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #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<Side side>
- float evaluate(void) const;
- private:
- template<Side side>
- BestMove minimax(int depth);
- };
- #endif // CHESSY_MINIMAX_H
|