change repetitionTable memory allocation place
This commit is contained in:
@ -21,14 +21,15 @@ static uint_least64_t perft(const struct gameState_t gameState, const uint_least
|
||||
for(uint_least8_t i = 0; i < movesLength; ++i) {
|
||||
const struct gameState_t newGameState = makeMove(gameState, moves[i]);
|
||||
nodes += perft(newGameState, depth - 1);
|
||||
undoMove(gameState.board, moves[i], gameState.color);
|
||||
undoMove(newGameState, moves[i], gameState.color);
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
||||
static void test(struct perf_t perf, const uint_least8_t i) {
|
||||
uint_least64_t board[BITBOARD_LENGTH];
|
||||
const struct gameState_t gameState = newGameState(board, perf.FEN);
|
||||
struct zobristTableElement repetitionTableStore[REPETETION_TABLE_LENGTH];
|
||||
const struct gameState_t gameState = newGameState(board, repetitionTableStore, perf.FEN);
|
||||
const uint_least64_t nodes = perft(gameState, perf.depth);
|
||||
if(perf.nodes != nodes) {
|
||||
printf("Test %" PRIuLEAST16 " failed: FEN: %s, depth: %" PRIuLEAST8 " calculated nodes: %" PRIuLEAST64
|
||||
@ -38,7 +39,7 @@ static void test(struct perf_t perf, const uint_least8_t i) {
|
||||
for(uint_least8_t j = 0; j < movesLength; ++j) {
|
||||
const struct gameState_t newGameState = makeMove(gameState, moves[j]);
|
||||
const uint_least64_t nodes = perft(newGameState, perf.depth - 1);
|
||||
undoMove(gameState.board, moves[j], gameState.color);
|
||||
undoMove(newGameState, moves[j], gameState.color);
|
||||
{
|
||||
printMove(moves[j]);
|
||||
printf(" %" PRIuLEAST64 "\n", nodes);
|
||||
|
||||
Reference in New Issue
Block a user