浏览代码

trying out castling

nicolaswinkler 7 年之前
父节点
当前提交
4c23340709
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12 0
      src/Minimax.cpp

+ 12 - 0
src/Minimax.cpp

@@ -206,6 +206,18 @@ MiniMax::BestMove MiniMax::minimax(int depth)
         board = temp;
     }
 
+    if (side == WHITE_SIDE) {
+        if (game.getCanCastleKingSide(side)) {
+            if((board.getWhites().bits & 0x6) == 0) {
+                Move kingMove = {3, 1};
+                Move rookMove = {0, 2};
+                king.applyMove(kingMove);
+                rs.applyMove(rookMove);
+                board = temp;
+            }
+        }
+    }
+
     for (auto pos : CastlingGenerator<side>{ game }) {
         Move move = { kingIndex, pos };
         king.applyMove(move);