Minimax.h 709 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef CHESSY_MINMAX_H
  2. #define CHESSY_MINIMAX_H
  3. #include "MoveGeneration.h"
  4. namespace chessy
  5. {
  6. class MiniMax;
  7. }
  8. class chessy::MiniMax
  9. {
  10. ChessGame& game;
  11. struct BestMove {
  12. Move move;
  13. float value;
  14. inline void overwriteIfBetter(BestMove other)
  15. {
  16. if (other.value > value)
  17. *this = other;
  18. }
  19. };
  20. public:
  21. inline MiniMax(ChessGame& game) :
  22. game{ game } {}
  23. Move calculateBest(int depth)
  24. {
  25. minimax<WHITE_SIDE>(depth);
  26. return {0, 0};
  27. }
  28. template<Side side>
  29. float evaluate(void) const;
  30. private:
  31. template<Side side>
  32. float minimax(int depth);
  33. };
  34. #endif // CHESSY_MINIMAX_H