Chess Engine
C++ chess engine with movegen, bitboards, and Arduino-friendly docs
Loading...
Searching...
No Matches
perft.cpp File Reference
#include <cstdio>
#include "../defs.h"
#include "../board/board.h"
#include "../move/move_generator.h"
#include "../move/make_move.h"
#include "../util/notation.h"
#include "../util/misc.h"
Include dependency graph for perft.cpp:

Go to the source code of this file.

Functions

void Perft (int depth, S_BOARD *pos)
 Runs a perft search from a given board state.
void PerftTest (int depth, S_BOARD *pos)
 Executes a perft test and prints move breakdown and timing.

Variables

long leafNodes = 0
 Global counter for leaf nodes visited during perft.

Function Documentation

◆ Perft()

void Perft ( int depth,
S_BOARD * pos )

Runs a perft search from a given board state.

Parameters
depthThe depth to search.
posPointer to the board state.

Definition at line 11 of file perft.cpp.

References ASSERT, S_MOVELIST::count, generateAllMoves(), isBoardStateValid(), leafNodes, makeMove(), S_MOVE::move, S_MOVELIST::moves, Perft(), and takeMove().

Referenced by Perft(), and PerftTest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PerftTest()

void PerftTest ( int depth,
S_BOARD * pos )

Executes a perft test and prints move breakdown and timing.

Parameters
depthThe depth to search.
posPointer to the board state.

Definition at line 32 of file perft.cpp.

References ASSERT, S_MOVELIST::count, generateAllMoves(), GetTimeMs(), isBoardStateValid(), leafNodes, makeMove(), S_MOVE::move, S_MOVELIST::moves, moveToString(), Perft(), printBoardState(), and takeMove().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ leafNodes

long leafNodes = 0

Global counter for leaf nodes visited during perft.

Definition at line 9 of file perft.cpp.

Referenced by Perft(), and PerftTest().