22 for (
int i = 0; i < list->
count; ++i) {
27 Perft(depth - 1, pos);
36 std::printf(
"\nStarting Test To Depth:%d\n", depth);
44 for (
int i = 0; i < list->
count; ++i) {
50 Perft(depth - 1, pos);
52 const long nodesForMove =
leafNodes - before;
53 std::printf(
"move %d : %s : %ld\n", i + 1,
moveToString(move), nodesForMove);
56 std::printf(
"\nTest Complete : %ld nodes visited in %dms\n",
bool isBoardStateValid(const S_BOARD *pos)
Performs a full internal consistency check of the board state.
void printBoardState(const S_BOARD *pos)
Print the board to stdout in a human-readable format.
int makeMove(S_BOARD *board, int move)
Make a move; returns non-zero if legal (king not left in check).
void takeMove(S_BOARD *board)
Undo the last made move.
void generateAllMoves(const S_BOARD *board, S_MOVELIST *moveList)
Generate all pseudo-legal moves for the side to move.
char * moveToString(const int move)
Convert an encoded move to coordinate notation.
void PerftTest(int depth, S_BOARD *pos)
Executes a perft test and prints move breakdown and timing.
void Perft(int depth, S_BOARD *pos)
Runs a perft search from a given board state.
long leafNodes
Global counter for leaf nodes visited during perft.
S_MOVE moves[MAXPOSITIONMOVES]