mirror of
https://github.com/OMGeeky/hcsalmon1-Chess-Engine-Test.git
synced 2026-02-23 15:49:51 +01:00
Update main.c
Removed unnecessary if statements and made move_list 50 elements
This commit is contained in:
144
C/main.c
144
C/main.c
@@ -714,10 +714,7 @@ unsigned long long PerftInlineStruct(Board *board, const int depth, const int pl
|
|||||||
{
|
{
|
||||||
const int pawn_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
const int pawn_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
||||||
|
|
||||||
if (check_bitboard == 0)
|
check_bitboard |= SQUARE_BBS[pawn_square];
|
||||||
{
|
|
||||||
check_bitboard = 1ULL << pawn_square;
|
|
||||||
}
|
|
||||||
|
|
||||||
whiteKingCheckCount++;
|
whiteKingCheckCount++;
|
||||||
}
|
}
|
||||||
@@ -728,10 +725,8 @@ unsigned long long PerftInlineStruct(Board *board, const int depth, const int pl
|
|||||||
{
|
{
|
||||||
const int knight_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
const int knight_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
||||||
|
|
||||||
if (check_bitboard == 0)
|
check_bitboard |= SQUARE_BBS[knight_square];
|
||||||
{
|
|
||||||
check_bitboard = SQUARE_BBS[knight_square];
|
|
||||||
}
|
|
||||||
|
|
||||||
whiteKingCheckCount++;
|
whiteKingCheckCount++;
|
||||||
}
|
}
|
||||||
@@ -746,10 +741,8 @@ unsigned long long PerftInlineStruct(Board *board, const int depth, const int pl
|
|||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
{
|
{
|
||||||
if (check_bitboard == 0)
|
check_bitboard |= INBETWEEN_BITBOARDS[whiteKingPosition][piece_square];
|
||||||
{
|
|
||||||
check_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square];
|
|
||||||
}
|
|
||||||
whiteKingCheckCount++;
|
whiteKingCheckCount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -776,10 +769,8 @@ unsigned long long PerftInlineStruct(Board *board, const int depth, const int pl
|
|||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
{
|
{
|
||||||
if (check_bitboard == 0)
|
check_bitboard |= INBETWEEN_BITBOARDS[whiteKingPosition][piece_square];
|
||||||
{
|
|
||||||
check_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square];
|
|
||||||
}
|
|
||||||
whiteKingCheckCount++;
|
whiteKingCheckCount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -806,11 +797,9 @@ unsigned long long PerftInlineStruct(Board *board, const int depth, const int pl
|
|||||||
temp_pin_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square] & WHITE_OCCUPANCIES_LOCAL;
|
temp_pin_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square] & WHITE_OCCUPANCIES_LOCAL;
|
||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
{
|
|
||||||
if (check_bitboard == 0)
|
|
||||||
{
|
{
|
||||||
check_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square];
|
check_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square];
|
||||||
}
|
|
||||||
whiteKingCheckCount++;
|
whiteKingCheckCount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -836,11 +825,9 @@ unsigned long long PerftInlineStruct(Board *board, const int depth, const int pl
|
|||||||
temp_pin_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square] & WHITE_OCCUPANCIES_LOCAL;
|
temp_pin_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square] & WHITE_OCCUPANCIES_LOCAL;
|
||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
{
|
|
||||||
if (check_bitboard == 0)
|
|
||||||
{
|
{
|
||||||
check_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square];
|
check_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square];
|
||||||
}
|
|
||||||
whiteKingCheckCount++;
|
whiteKingCheckCount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1498,10 +1485,7 @@ unsigned long long PerftInlineStruct(Board *board, const int depth, const int pl
|
|||||||
{
|
{
|
||||||
const int pawn_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
const int pawn_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
||||||
|
|
||||||
if (check_bitboard == 0)
|
check_bitboard |= SQUARE_BBS[pawn_square];
|
||||||
{
|
|
||||||
check_bitboard = SQUARE_BBS[pawn_square];
|
|
||||||
}
|
|
||||||
|
|
||||||
blackKingCheckCount++;
|
blackKingCheckCount++;
|
||||||
}
|
}
|
||||||
@@ -1510,12 +1494,9 @@ unsigned long long PerftInlineStruct(Board *board, const int depth, const int pl
|
|||||||
temp_bitboard = board->pieceArray[WN] & KNIGHT_ATTACKS[blackKingPosition];
|
temp_bitboard = board->pieceArray[WN] & KNIGHT_ATTACKS[blackKingPosition];
|
||||||
if (temp_bitboard != 0)
|
if (temp_bitboard != 0)
|
||||||
{
|
{
|
||||||
int knight_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
const int knight_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
||||||
|
|
||||||
if (check_bitboard == 0)
|
|
||||||
{
|
|
||||||
check_bitboard = SQUARE_BBS[knight_square];
|
check_bitboard = SQUARE_BBS[knight_square];
|
||||||
}
|
|
||||||
|
|
||||||
blackKingCheckCount++;
|
blackKingCheckCount++;
|
||||||
}
|
}
|
||||||
@@ -1525,21 +1506,18 @@ unsigned long long PerftInlineStruct(Board *board, const int depth, const int pl
|
|||||||
temp_bitboard = board->pieceArray[WB] & bishopAttacksChecks;
|
temp_bitboard = board->pieceArray[WB] & bishopAttacksChecks;
|
||||||
while (temp_bitboard != 0)
|
while (temp_bitboard != 0)
|
||||||
{
|
{
|
||||||
int piece_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
const int piece_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
||||||
|
|
||||||
temp_pin_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square] & BLACK_OCCUPANCIES_LOCAL;
|
temp_pin_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square] & BLACK_OCCUPANCIES_LOCAL;
|
||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
{
|
|
||||||
if (check_bitboard == 0)
|
|
||||||
{
|
{
|
||||||
check_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square];
|
check_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square];
|
||||||
}
|
|
||||||
blackKingCheckCount++;
|
blackKingCheckCount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int pinned_square = (DEBRUIJN64[MAGIC * (temp_pin_bitboard ^ (temp_pin_bitboard - 1)) >> 58]);
|
const int pinned_square = (DEBRUIJN64[MAGIC * (temp_pin_bitboard ^ (temp_pin_bitboard - 1)) >> 58]);
|
||||||
temp_pin_bitboard &= temp_pin_bitboard - 1;
|
temp_pin_bitboard &= temp_pin_bitboard - 1;
|
||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
@@ -1556,21 +1534,18 @@ unsigned long long PerftInlineStruct(Board *board, const int depth, const int pl
|
|||||||
temp_bitboard = board->pieceArray[WQ] & bishopAttacksChecks;
|
temp_bitboard = board->pieceArray[WQ] & bishopAttacksChecks;
|
||||||
while (temp_bitboard != 0)
|
while (temp_bitboard != 0)
|
||||||
{
|
{
|
||||||
int piece_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
const int piece_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
||||||
|
|
||||||
temp_pin_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square] & BLACK_OCCUPANCIES_LOCAL;
|
temp_pin_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square] & BLACK_OCCUPANCIES_LOCAL;
|
||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
{
|
|
||||||
if (check_bitboard == 0)
|
|
||||||
{
|
{
|
||||||
check_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square];
|
check_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square];
|
||||||
}
|
|
||||||
blackKingCheckCount++;
|
blackKingCheckCount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int pinned_square = (DEBRUIJN64[MAGIC * (temp_pin_bitboard ^ (temp_pin_bitboard - 1)) >> 58]);
|
const int pinned_square = (DEBRUIJN64[MAGIC * (temp_pin_bitboard ^ (temp_pin_bitboard - 1)) >> 58]);
|
||||||
temp_pin_bitboard &= temp_pin_bitboard - 1;
|
temp_pin_bitboard &= temp_pin_bitboard - 1;
|
||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
@@ -1584,25 +1559,22 @@ unsigned long long PerftInlineStruct(Board *board, const int depth, const int pl
|
|||||||
}
|
}
|
||||||
|
|
||||||
//rook
|
//rook
|
||||||
unsigned long long rook_attacks = GetRookAttacksFast(blackKingPosition, WHITE_OCCUPANCIES_LOCAL);
|
const unsigned long long rook_attacks = GetRookAttacksFast(blackKingPosition, WHITE_OCCUPANCIES_LOCAL);
|
||||||
temp_bitboard = board->pieceArray[WR] & rook_attacks;
|
temp_bitboard = board->pieceArray[WR] & rook_attacks;
|
||||||
while (temp_bitboard != 0)
|
while (temp_bitboard != 0)
|
||||||
{
|
{
|
||||||
int piece_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
const int piece_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
||||||
|
|
||||||
temp_pin_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square] & BLACK_OCCUPANCIES_LOCAL;
|
temp_pin_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square] & BLACK_OCCUPANCIES_LOCAL;
|
||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
{
|
|
||||||
if (check_bitboard == 0)
|
|
||||||
{
|
{
|
||||||
check_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square];
|
check_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square];
|
||||||
}
|
|
||||||
blackKingCheckCount++;
|
blackKingCheckCount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int pinned_square = (DEBRUIJN64[MAGIC * (temp_pin_bitboard ^ (temp_pin_bitboard - 1)) >> 58]);
|
const int pinned_square = (DEBRUIJN64[MAGIC * (temp_pin_bitboard ^ (temp_pin_bitboard - 1)) >> 58]);
|
||||||
temp_pin_bitboard &= temp_pin_bitboard - 1;
|
temp_pin_bitboard &= temp_pin_bitboard - 1;
|
||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
@@ -1619,21 +1591,18 @@ unsigned long long PerftInlineStruct(Board *board, const int depth, const int pl
|
|||||||
temp_bitboard = board->pieceArray[WQ] & rook_attacks;
|
temp_bitboard = board->pieceArray[WQ] & rook_attacks;
|
||||||
while (temp_bitboard != 0)
|
while (temp_bitboard != 0)
|
||||||
{
|
{
|
||||||
int piece_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
const int piece_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
||||||
|
|
||||||
temp_pin_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square] & BLACK_OCCUPANCIES_LOCAL;
|
temp_pin_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square] & BLACK_OCCUPANCIES_LOCAL;
|
||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
{
|
{
|
||||||
if (check_bitboard == 0)
|
check_bitboard |= INBETWEEN_BITBOARDS[blackKingPosition][piece_square];
|
||||||
{
|
|
||||||
check_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square];
|
|
||||||
}
|
|
||||||
blackKingCheckCount++;
|
blackKingCheckCount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int pinned_square = (DEBRUIJN64[MAGIC * (temp_pin_bitboard ^ (temp_pin_bitboard - 1)) >> 58]);
|
const int pinned_square = (DEBRUIJN64[MAGIC * (temp_pin_bitboard ^ (temp_pin_bitboard - 1)) >> 58]);
|
||||||
temp_pin_bitboard &= temp_pin_bitboard - 1;
|
temp_pin_bitboard &= temp_pin_bitboard - 1;
|
||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
@@ -1652,10 +1621,6 @@ unsigned long long PerftInlineStruct(Board *board, const int depth, const int pl
|
|||||||
{
|
{
|
||||||
#pragma region Black king
|
#pragma region Black king
|
||||||
const unsigned long long occupancyWithoutBlackKing = COMBINED_OCCUPANCIES_LOCAL & (~board->pieceArray[BK]);
|
const unsigned long long occupancyWithoutBlackKing = COMBINED_OCCUPANCIES_LOCAL & (~board->pieceArray[BK]);
|
||||||
if (blackKingPosition == -1)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
temp_attack = KING_ATTACKS[blackKingPosition] & WHITE_OCCUPANCIES_LOCAL;
|
temp_attack = KING_ATTACKS[blackKingPosition] & WHITE_OCCUPANCIES_LOCAL;
|
||||||
|
|
||||||
while (temp_attack != 0)
|
while (temp_attack != 0)
|
||||||
@@ -2856,7 +2821,7 @@ unsigned long long PerftInlineGlobalOcc(const int depth, const int ply)
|
|||||||
// return 1;
|
// return 1;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
int move_list[250][4];
|
int move_list[50][4];
|
||||||
int move_count = 0;
|
int move_count = 0;
|
||||||
|
|
||||||
//Move generating variables
|
//Move generating variables
|
||||||
@@ -2896,10 +2861,7 @@ unsigned long long PerftInlineGlobalOcc(const int depth, const int ply)
|
|||||||
{
|
{
|
||||||
const int pawn_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
const int pawn_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
||||||
|
|
||||||
if (check_bitboard == 0)
|
|
||||||
{
|
|
||||||
check_bitboard = 1ULL << pawn_square;
|
check_bitboard = 1ULL << pawn_square;
|
||||||
}
|
|
||||||
|
|
||||||
whiteKingCheckCount++;
|
whiteKingCheckCount++;
|
||||||
}
|
}
|
||||||
@@ -2910,10 +2872,8 @@ unsigned long long PerftInlineGlobalOcc(const int depth, const int ply)
|
|||||||
{
|
{
|
||||||
const int knight_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
const int knight_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
||||||
|
|
||||||
if (check_bitboard == 0)
|
|
||||||
{
|
|
||||||
check_bitboard = SQUARE_BBS[knight_square];
|
check_bitboard = SQUARE_BBS[knight_square];
|
||||||
}
|
|
||||||
|
|
||||||
whiteKingCheckCount++;
|
whiteKingCheckCount++;
|
||||||
}
|
}
|
||||||
@@ -2927,11 +2887,9 @@ unsigned long long PerftInlineGlobalOcc(const int depth, const int ply)
|
|||||||
temp_pin_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square] & WHITE_OCCUPANCIES_LOCAL;
|
temp_pin_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square] & WHITE_OCCUPANCIES_LOCAL;
|
||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
{
|
|
||||||
if (check_bitboard == 0)
|
|
||||||
{
|
{
|
||||||
check_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square];
|
check_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square];
|
||||||
}
|
|
||||||
whiteKingCheckCount++;
|
whiteKingCheckCount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2957,11 +2915,9 @@ unsigned long long PerftInlineGlobalOcc(const int depth, const int ply)
|
|||||||
temp_pin_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square] & WHITE_OCCUPANCIES_LOCAL;
|
temp_pin_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square] & WHITE_OCCUPANCIES_LOCAL;
|
||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
{
|
|
||||||
if (check_bitboard == 0)
|
|
||||||
{
|
{
|
||||||
check_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square];
|
check_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square];
|
||||||
}
|
|
||||||
whiteKingCheckCount++;
|
whiteKingCheckCount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2988,11 +2944,9 @@ unsigned long long PerftInlineGlobalOcc(const int depth, const int ply)
|
|||||||
temp_pin_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square] & WHITE_OCCUPANCIES_LOCAL;
|
temp_pin_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square] & WHITE_OCCUPANCIES_LOCAL;
|
||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
{
|
|
||||||
if (check_bitboard == 0)
|
|
||||||
{
|
{
|
||||||
check_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square];
|
check_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square];
|
||||||
}
|
|
||||||
whiteKingCheckCount++;
|
whiteKingCheckCount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -3018,11 +2972,9 @@ unsigned long long PerftInlineGlobalOcc(const int depth, const int ply)
|
|||||||
temp_pin_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square] & WHITE_OCCUPANCIES_LOCAL;
|
temp_pin_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square] & WHITE_OCCUPANCIES_LOCAL;
|
||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
{
|
|
||||||
if (check_bitboard == 0)
|
|
||||||
{
|
{
|
||||||
check_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square];
|
check_bitboard = INBETWEEN_BITBOARDS[whiteKingPosition][piece_square];
|
||||||
}
|
|
||||||
whiteKingCheckCount++;
|
whiteKingCheckCount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -3680,10 +3632,7 @@ unsigned long long PerftInlineGlobalOcc(const int depth, const int ply)
|
|||||||
{
|
{
|
||||||
const int pawn_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
const int pawn_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
||||||
|
|
||||||
if (check_bitboard == 0)
|
|
||||||
{
|
|
||||||
check_bitboard = SQUARE_BBS[pawn_square];
|
check_bitboard = SQUARE_BBS[pawn_square];
|
||||||
}
|
|
||||||
|
|
||||||
blackKingCheckCount++;
|
blackKingCheckCount++;
|
||||||
}
|
}
|
||||||
@@ -3692,12 +3641,9 @@ unsigned long long PerftInlineGlobalOcc(const int depth, const int ply)
|
|||||||
temp_bitboard = bitboard_array_global[WN] & KNIGHT_ATTACKS[blackKingPosition];
|
temp_bitboard = bitboard_array_global[WN] & KNIGHT_ATTACKS[blackKingPosition];
|
||||||
if (temp_bitboard != 0)
|
if (temp_bitboard != 0)
|
||||||
{
|
{
|
||||||
int knight_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
const int knight_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
||||||
|
|
||||||
if (check_bitboard == 0)
|
|
||||||
{
|
|
||||||
check_bitboard = SQUARE_BBS[knight_square];
|
check_bitboard = SQUARE_BBS[knight_square];
|
||||||
}
|
|
||||||
|
|
||||||
blackKingCheckCount++;
|
blackKingCheckCount++;
|
||||||
}
|
}
|
||||||
@@ -3707,7 +3653,7 @@ unsigned long long PerftInlineGlobalOcc(const int depth, const int ply)
|
|||||||
temp_bitboard = bitboard_array_global[WB] & bishopAttacksChecks;
|
temp_bitboard = bitboard_array_global[WB] & bishopAttacksChecks;
|
||||||
while (temp_bitboard != 0)
|
while (temp_bitboard != 0)
|
||||||
{
|
{
|
||||||
int piece_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
const int piece_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
||||||
|
|
||||||
temp_pin_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square] & BLACK_OCCUPANCIES_LOCAL;
|
temp_pin_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square] & BLACK_OCCUPANCIES_LOCAL;
|
||||||
|
|
||||||
@@ -3721,7 +3667,7 @@ unsigned long long PerftInlineGlobalOcc(const int depth, const int ply)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int pinned_square = (DEBRUIJN64[MAGIC * (temp_pin_bitboard ^ (temp_pin_bitboard - 1)) >> 58]);
|
const int pinned_square = (DEBRUIJN64[MAGIC * (temp_pin_bitboard ^ (temp_pin_bitboard - 1)) >> 58]);
|
||||||
temp_pin_bitboard &= temp_pin_bitboard - 1;
|
temp_pin_bitboard &= temp_pin_bitboard - 1;
|
||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
@@ -3738,7 +3684,7 @@ unsigned long long PerftInlineGlobalOcc(const int depth, const int ply)
|
|||||||
temp_bitboard = bitboard_array_global[WQ] & bishopAttacksChecks;
|
temp_bitboard = bitboard_array_global[WQ] & bishopAttacksChecks;
|
||||||
while (temp_bitboard != 0)
|
while (temp_bitboard != 0)
|
||||||
{
|
{
|
||||||
int piece_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
const int piece_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
||||||
|
|
||||||
temp_pin_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square] & BLACK_OCCUPANCIES_LOCAL;
|
temp_pin_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square] & BLACK_OCCUPANCIES_LOCAL;
|
||||||
|
|
||||||
@@ -3752,7 +3698,7 @@ unsigned long long PerftInlineGlobalOcc(const int depth, const int ply)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int pinned_square = (DEBRUIJN64[MAGIC * (temp_pin_bitboard ^ (temp_pin_bitboard - 1)) >> 58]);
|
const int pinned_square = (DEBRUIJN64[MAGIC * (temp_pin_bitboard ^ (temp_pin_bitboard - 1)) >> 58]);
|
||||||
temp_pin_bitboard &= temp_pin_bitboard - 1;
|
temp_pin_bitboard &= temp_pin_bitboard - 1;
|
||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
@@ -3766,11 +3712,11 @@ unsigned long long PerftInlineGlobalOcc(const int depth, const int ply)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//rook
|
//rook
|
||||||
unsigned long long rook_attacks = GetRookAttacksFast(blackKingPosition, WHITE_OCCUPANCIES_LOCAL);
|
const unsigned long long rook_attacks = GetRookAttacksFast(blackKingPosition, WHITE_OCCUPANCIES_LOCAL);
|
||||||
temp_bitboard = bitboard_array_global[WR] & rook_attacks;
|
temp_bitboard = bitboard_array_global[WR] & rook_attacks;
|
||||||
while (temp_bitboard != 0)
|
while (temp_bitboard != 0)
|
||||||
{
|
{
|
||||||
int piece_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
const int piece_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
||||||
|
|
||||||
temp_pin_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square] & BLACK_OCCUPANCIES_LOCAL;
|
temp_pin_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square] & BLACK_OCCUPANCIES_LOCAL;
|
||||||
|
|
||||||
@@ -3784,7 +3730,7 @@ unsigned long long PerftInlineGlobalOcc(const int depth, const int ply)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int pinned_square = (DEBRUIJN64[MAGIC * (temp_pin_bitboard ^ (temp_pin_bitboard - 1)) >> 58]);
|
const int pinned_square = (DEBRUIJN64[MAGIC * (temp_pin_bitboard ^ (temp_pin_bitboard - 1)) >> 58]);
|
||||||
temp_pin_bitboard &= temp_pin_bitboard - 1;
|
temp_pin_bitboard &= temp_pin_bitboard - 1;
|
||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
@@ -3801,7 +3747,7 @@ unsigned long long PerftInlineGlobalOcc(const int depth, const int ply)
|
|||||||
temp_bitboard = bitboard_array_global[WQ] & rook_attacks;
|
temp_bitboard = bitboard_array_global[WQ] & rook_attacks;
|
||||||
while (temp_bitboard != 0)
|
while (temp_bitboard != 0)
|
||||||
{
|
{
|
||||||
int piece_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
const int piece_square = (DEBRUIJN64[MAGIC * (temp_bitboard ^ (temp_bitboard - 1)) >> 58]);
|
||||||
|
|
||||||
temp_pin_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square] & BLACK_OCCUPANCIES_LOCAL;
|
temp_pin_bitboard = INBETWEEN_BITBOARDS[blackKingPosition][piece_square] & BLACK_OCCUPANCIES_LOCAL;
|
||||||
|
|
||||||
@@ -3815,7 +3761,7 @@ unsigned long long PerftInlineGlobalOcc(const int depth, const int ply)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int pinned_square = (DEBRUIJN64[MAGIC * (temp_pin_bitboard ^ (temp_pin_bitboard - 1)) >> 58]);
|
const int pinned_square = (DEBRUIJN64[MAGIC * (temp_pin_bitboard ^ (temp_pin_bitboard - 1)) >> 58]);
|
||||||
temp_pin_bitboard &= temp_pin_bitboard - 1;
|
temp_pin_bitboard &= temp_pin_bitboard - 1;
|
||||||
|
|
||||||
if (temp_pin_bitboard == 0)
|
if (temp_pin_bitboard == 0)
|
||||||
@@ -3834,10 +3780,6 @@ unsigned long long PerftInlineGlobalOcc(const int depth, const int ply)
|
|||||||
{
|
{
|
||||||
#pragma region Black king
|
#pragma region Black king
|
||||||
const unsigned long long occupancyWithoutBlackKing = COMBINED_OCCUPANCIES_LOCAL & (~bitboard_array_global[BK]);
|
const unsigned long long occupancyWithoutBlackKing = COMBINED_OCCUPANCIES_LOCAL & (~bitboard_array_global[BK]);
|
||||||
if (blackKingPosition == -1)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
temp_attack = KING_ATTACKS[blackKingPosition] & WHITE_OCCUPANCIES_LOCAL;
|
temp_attack = KING_ATTACKS[blackKingPosition] & WHITE_OCCUPANCIES_LOCAL;
|
||||||
|
|
||||||
while (temp_attack != 0)
|
while (temp_attack != 0)
|
||||||
@@ -4464,11 +4406,13 @@ unsigned long long PerftInlineGlobalOcc(const int depth, const int ply)
|
|||||||
|
|
||||||
unsigned long long nodes = 0, priorNodes;
|
unsigned long long nodes = 0, priorNodes;
|
||||||
int copyEp = ep_global;
|
int copyEp = ep_global;
|
||||||
int copy_castle[4];
|
const int copy_castle[4] =
|
||||||
copy_castle[0] = castle_rights_global[0];
|
{
|
||||||
copy_castle[1] = castle_rights_global[1];
|
castle_rights_global[0],
|
||||||
copy_castle[2] = castle_rights_global[2];
|
castle_rights_global[1],
|
||||||
copy_castle[3] = castle_rights_global[3];
|
castle_rights_global[2],
|
||||||
|
castle_rights_global[3],
|
||||||
|
};
|
||||||
|
|
||||||
for (size_t move_index = 0; move_index < move_count; ++move_index)
|
for (size_t move_index = 0; move_index < move_count; ++move_index)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user