Nicolas Winkler 7 anos atrás
pai
commit
46b3fd75bf
3 arquivos alterados com 7 adições e 23 exclusões
  1. 5 0
      src/ChessGame.h
  2. 2 1
      src/Minimax.cpp
  3. 0 22
      src/Search.h

+ 5 - 0
src/ChessGame.h

@@ -35,6 +35,11 @@ struct chessy::MoveInfo
 };
 
 
+struct chessy::UndoInfo
+{
+};
+
+
 class chessy::ChessGame
 {
     Board board;

+ 2 - 1
src/Minimax.cpp

@@ -13,9 +13,10 @@ size_t Perft::search(void)
     size_t result = 0;
     auto searcher = [&result] (const MoveInfo& mi, ChessGame& cg, int depth) {
         if (depth > 0) {
-            cg.doMove(mi);
+            UndoInfo ui = cg.doMove(mi);
             Perft p{ depth - 1, cg };
             result += p.search();
+            cg.undoMove(ui);
         }
         else {
             result++;

+ 0 - 22
src/Search.h

@@ -9,32 +9,10 @@ namespace chessy
     template<typename T>
     class Search;
 
-    struct MoveInfo;
-
     class MinimaxN;
 }
 
 
-/*!
- * This structure holds additional information about a move.
- */
-struct chessy::MoveInfo
-{
-    //! the move itself
-    Move move;
-
-    //! the type of the piece that was moved
-    PieceType movedPiece;
-
-    //! if the move is an en-passant move, this field holds the square of
-    //! the pawn, that was captured. Otherwise this index should be zero.
-    Index enPassantTarget;
-
-    inline MoveInfo(void) :
-        enPassantTarget{ 0 } {}
-};
-
-
 template<typename T>
 class chessy::Search
 {