@@ -35,6 +35,11 @@ struct chessy::MoveInfo
};
+struct chessy::UndoInfo
+{
+};
+
class chessy::ChessGame
{
Board board;
@@ -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++;
@@ -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 } {}
-};
class chessy::Search