mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Better naming borrowed from Critter
In line with http://chessprogramming.wikispaces.com conventions. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
25b4d0c127
commit
c2c185423b
16 changed files with 213 additions and 214 deletions
|
@ -104,9 +104,9 @@ namespace {
|
|||
|
||||
int compute_index(Square wksq, Square bksq, Square wpsq, Color stm) {
|
||||
|
||||
assert(square_file(wpsq) <= FILE_D);
|
||||
assert(file_of(wpsq) <= FILE_D);
|
||||
|
||||
int p = square_file(wpsq) + 4 * (square_rank(wpsq) - 1);
|
||||
int p = file_of(wpsq) + 4 * (rank_of(wpsq) - 1);
|
||||
int r = stm + 2 * bksq + 128 * wksq + 8192 * p;
|
||||
|
||||
assert(r >= 0 && r < IndexMax);
|
||||
|
@ -140,7 +140,7 @@ namespace {
|
|||
|
||||
// The position is an immediate win if it is white to move and the
|
||||
// white pawn can be promoted without getting captured.
|
||||
if ( square_rank(pawnSquare) == RANK_7
|
||||
if ( rank_of(pawnSquare) == RANK_7
|
||||
&& sideToMove == WHITE
|
||||
&& whiteKingSquare != pawnSquare + DELTA_N
|
||||
&& ( square_distance(blackKingSquare, pawnSquare + DELTA_N) > 1
|
||||
|
@ -161,19 +161,19 @@ namespace {
|
|||
|
||||
// Case 3: Black king in front of white pawn
|
||||
if ( blackKingSquare == pawnSquare + DELTA_N
|
||||
&& square_rank(pawnSquare) < RANK_7)
|
||||
&& rank_of(pawnSquare) < RANK_7)
|
||||
return RESULT_DRAW;
|
||||
|
||||
// Case 4: White king in front of pawn and black has opposition
|
||||
if ( whiteKingSquare == pawnSquare + DELTA_N
|
||||
&& blackKingSquare == pawnSquare + DELTA_N + DELTA_N + DELTA_N
|
||||
&& square_rank(pawnSquare) < RANK_5
|
||||
&& rank_of(pawnSquare) < RANK_5
|
||||
&& sideToMove == WHITE)
|
||||
return RESULT_DRAW;
|
||||
|
||||
// Case 5: Stalemate with rook pawn
|
||||
if ( blackKingSquare == SQ_A8
|
||||
&& square_file(pawnSquare) == FILE_A)
|
||||
&& file_of(pawnSquare) == FILE_A)
|
||||
return RESULT_DRAW;
|
||||
|
||||
return RESULT_UNKNOWN;
|
||||
|
@ -213,7 +213,7 @@ namespace {
|
|||
}
|
||||
|
||||
// Pawn moves
|
||||
if (square_rank(pawnSquare) < RANK_7)
|
||||
if (rank_of(pawnSquare) < RANK_7)
|
||||
{
|
||||
s = pawnSquare + DELTA_N;
|
||||
r = db[compute_index(whiteKingSquare, blackKingSquare, s, BLACK)];
|
||||
|
@ -225,7 +225,7 @@ namespace {
|
|||
unknownFound = true;
|
||||
|
||||
// Double pawn push
|
||||
if (square_rank(s) == RANK_3 && r != RESULT_INVALID)
|
||||
if (rank_of(s) == RANK_3 && r != RESULT_INVALID)
|
||||
{
|
||||
s += DELTA_N;
|
||||
r = db[compute_index(whiteKingSquare, blackKingSquare, s, BLACK)];
|
||||
|
|
|
@ -325,7 +325,7 @@ namespace {
|
|||
} while (b);
|
||||
|
||||
offset += maxKey;
|
||||
booster = MagicBoosters[CpuIs64Bit][square_rank(s)];
|
||||
booster = MagicBoosters[CpuIs64Bit][rank_of(s)];
|
||||
|
||||
// Then find a possible magic and the corresponding attacks
|
||||
do {
|
||||
|
|
|
@ -113,7 +113,7 @@ inline Bitboard rank_bb(Rank r) {
|
|||
}
|
||||
|
||||
inline Bitboard rank_bb(Square s) {
|
||||
return RankBB[square_rank(s)];
|
||||
return RankBB[rank_of(s)];
|
||||
}
|
||||
|
||||
inline Bitboard file_bb(File f) {
|
||||
|
@ -121,7 +121,7 @@ inline Bitboard file_bb(File f) {
|
|||
}
|
||||
|
||||
inline Bitboard file_bb(Square s) {
|
||||
return FileBB[square_file(s)];
|
||||
return FileBB[file_of(s)];
|
||||
}
|
||||
|
||||
|
||||
|
@ -133,7 +133,7 @@ inline Bitboard neighboring_files_bb(File f) {
|
|||
}
|
||||
|
||||
inline Bitboard neighboring_files_bb(Square s) {
|
||||
return NeighboringFilesBB[square_file(s)];
|
||||
return NeighboringFilesBB[file_of(s)];
|
||||
}
|
||||
|
||||
|
||||
|
@ -145,7 +145,7 @@ inline Bitboard this_and_neighboring_files_bb(File f) {
|
|||
}
|
||||
|
||||
inline Bitboard this_and_neighboring_files_bb(Square s) {
|
||||
return ThisAndNeighboringFilesBB[square_file(s)];
|
||||
return ThisAndNeighboringFilesBB[file_of(s)];
|
||||
}
|
||||
|
||||
|
||||
|
@ -160,7 +160,7 @@ inline Bitboard in_front_bb(Color c, Rank r) {
|
|||
}
|
||||
|
||||
inline Bitboard in_front_bb(Color c, Square s) {
|
||||
return InFrontBB[c][square_rank(s)];
|
||||
return InFrontBB[c][rank_of(s)];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -335,7 +335,7 @@ namespace {
|
|||
result ^= ZobCastle[3];
|
||||
|
||||
if (pos.ep_square() != SQ_NONE)
|
||||
result ^= ZobEnPassant[square_file(pos.ep_square())];
|
||||
result ^= ZobEnPassant[file_of(pos.ep_square())];
|
||||
|
||||
if (pos.side_to_move() == WHITE)
|
||||
result ^= ZobTurn[0];
|
||||
|
|
126
src/endgame.cpp
126
src/endgame.cpp
|
@ -189,8 +189,8 @@ Value Endgame<KBNK>::apply(const Position& pos) const {
|
|||
// mirror the kings so to drive enemy toward corners A8 or H1.
|
||||
if (opposite_color_squares(bishopSquare, SQ_A1))
|
||||
{
|
||||
winnerKSq = flop_square(winnerKSq);
|
||||
loserKSq = flop_square(loserKSq);
|
||||
winnerKSq = mirror(winnerKSq);
|
||||
loserKSq = mirror(loserKSq);
|
||||
}
|
||||
|
||||
Value result = VALUE_KNOWN_WIN
|
||||
|
@ -222,17 +222,17 @@ Value Endgame<KPK>::apply(const Position& pos) const {
|
|||
}
|
||||
else
|
||||
{
|
||||
wksq = flip_square(pos.king_square(BLACK));
|
||||
bksq = flip_square(pos.king_square(WHITE));
|
||||
wpsq = flip_square(pos.piece_list(BLACK, PAWN)[0]);
|
||||
stm = opposite_color(pos.side_to_move());
|
||||
wksq = flip(pos.king_square(BLACK));
|
||||
bksq = flip(pos.king_square(WHITE));
|
||||
wpsq = flip(pos.piece_list(BLACK, PAWN)[0]);
|
||||
stm = flip(pos.side_to_move());
|
||||
}
|
||||
|
||||
if (square_file(wpsq) >= FILE_E)
|
||||
if (file_of(wpsq) >= FILE_E)
|
||||
{
|
||||
wksq = flop_square(wksq);
|
||||
bksq = flop_square(bksq);
|
||||
wpsq = flop_square(wpsq);
|
||||
wksq = mirror(wksq);
|
||||
bksq = mirror(bksq);
|
||||
wpsq = mirror(wpsq);
|
||||
}
|
||||
|
||||
if (!probe_kpk_bitbase(wksq, wpsq, bksq, stm))
|
||||
|
@ -240,7 +240,7 @@ Value Endgame<KPK>::apply(const Position& pos) const {
|
|||
|
||||
Value result = VALUE_KNOWN_WIN
|
||||
+ PawnValueEndgame
|
||||
+ Value(square_rank(wpsq));
|
||||
+ Value(rank_of(wpsq));
|
||||
|
||||
return strongerSide == pos.side_to_move() ? result : -result;
|
||||
}
|
||||
|
@ -268,17 +268,17 @@ Value Endgame<KRKP>::apply(const Position& pos) const {
|
|||
|
||||
if (strongerSide == BLACK)
|
||||
{
|
||||
wksq = flip_square(wksq);
|
||||
wrsq = flip_square(wrsq);
|
||||
bksq = flip_square(bksq);
|
||||
bpsq = flip_square(bpsq);
|
||||
wksq = flip(wksq);
|
||||
wrsq = flip(wrsq);
|
||||
bksq = flip(bksq);
|
||||
bpsq = flip(bpsq);
|
||||
}
|
||||
|
||||
Square queeningSq = make_square(square_file(bpsq), RANK_1);
|
||||
Square queeningSq = make_square(file_of(bpsq), RANK_1);
|
||||
Value result;
|
||||
|
||||
// If the stronger side's king is in front of the pawn, it's a win
|
||||
if (wksq < bpsq && square_file(wksq) == square_file(bpsq))
|
||||
if (wksq < bpsq && file_of(wksq) == file_of(bpsq))
|
||||
result = RookValueEndgame - Value(square_distance(wksq, bpsq));
|
||||
|
||||
// If the weaker side's king is too far from the pawn and the rook,
|
||||
|
@ -289,9 +289,9 @@ Value Endgame<KRKP>::apply(const Position& pos) const {
|
|||
|
||||
// If the pawn is far advanced and supported by the defending king,
|
||||
// the position is drawish
|
||||
else if ( square_rank(bksq) <= RANK_3
|
||||
else if ( rank_of(bksq) <= RANK_3
|
||||
&& square_distance(bksq, bpsq) == 1
|
||||
&& square_rank(wksq) >= RANK_4
|
||||
&& rank_of(wksq) >= RANK_4
|
||||
&& square_distance(wksq, bpsq) - tempo > 2)
|
||||
result = Value(80 - square_distance(wksq, bpsq) * 8);
|
||||
|
||||
|
@ -423,7 +423,7 @@ ScaleFactor Endgame<KBPsK>::apply(const Position& pos) const {
|
|||
// be detected even when the weaker side has some pawns.
|
||||
|
||||
Bitboard pawns = pos.pieces(PAWN, strongerSide);
|
||||
File pawnFile = square_file(pos.piece_list(strongerSide, PAWN)[0]);
|
||||
File pawnFile = file_of(pos.piece_list(strongerSide, PAWN)[0]);
|
||||
|
||||
// All pawns are on a single rook file ?
|
||||
if ( (pawnFile == FILE_A || pawnFile == FILE_H)
|
||||
|
@ -434,7 +434,7 @@ ScaleFactor Endgame<KBPsK>::apply(const Position& pos) const {
|
|||
Square kingSq = pos.king_square(weakerSide);
|
||||
|
||||
if ( opposite_color_squares(queeningSq, bishopSq)
|
||||
&& abs(square_file(kingSq) - pawnFile) <= 1)
|
||||
&& abs(file_of(kingSq) - pawnFile) <= 1)
|
||||
{
|
||||
// The bishop has the wrong color, and the defending king is on the
|
||||
// file of the pawn(s) or the neighboring file. Find the rank of the
|
||||
|
@ -515,23 +515,23 @@ ScaleFactor Endgame<KRPKR>::apply(const Position& pos) const {
|
|||
// pawn is on the left half of the board.
|
||||
if (strongerSide == BLACK)
|
||||
{
|
||||
wksq = flip_square(wksq);
|
||||
wrsq = flip_square(wrsq);
|
||||
wpsq = flip_square(wpsq);
|
||||
bksq = flip_square(bksq);
|
||||
brsq = flip_square(brsq);
|
||||
wksq = flip(wksq);
|
||||
wrsq = flip(wrsq);
|
||||
wpsq = flip(wpsq);
|
||||
bksq = flip(bksq);
|
||||
brsq = flip(brsq);
|
||||
}
|
||||
if (square_file(wpsq) > FILE_D)
|
||||
if (file_of(wpsq) > FILE_D)
|
||||
{
|
||||
wksq = flop_square(wksq);
|
||||
wrsq = flop_square(wrsq);
|
||||
wpsq = flop_square(wpsq);
|
||||
bksq = flop_square(bksq);
|
||||
brsq = flop_square(brsq);
|
||||
wksq = mirror(wksq);
|
||||
wrsq = mirror(wrsq);
|
||||
wpsq = mirror(wpsq);
|
||||
bksq = mirror(bksq);
|
||||
brsq = mirror(brsq);
|
||||
}
|
||||
|
||||
File f = square_file(wpsq);
|
||||
Rank r = square_rank(wpsq);
|
||||
File f = file_of(wpsq);
|
||||
Rank r = rank_of(wpsq);
|
||||
Square queeningSq = make_square(f, RANK_8);
|
||||
int tempo = (pos.side_to_move() == strongerSide);
|
||||
|
||||
|
@ -540,20 +540,20 @@ ScaleFactor Endgame<KRPKR>::apply(const Position& pos) const {
|
|||
if ( r <= RANK_5
|
||||
&& square_distance(bksq, queeningSq) <= 1
|
||||
&& wksq <= SQ_H5
|
||||
&& (square_rank(brsq) == RANK_6 || (r <= RANK_3 && square_rank(wrsq) != RANK_6)))
|
||||
&& (rank_of(brsq) == RANK_6 || (r <= RANK_3 && rank_of(wrsq) != RANK_6)))
|
||||
return SCALE_FACTOR_ZERO;
|
||||
|
||||
// The defending side saves a draw by checking from behind in case the pawn
|
||||
// has advanced to the 6th rank with the king behind.
|
||||
if ( r == RANK_6
|
||||
&& square_distance(bksq, queeningSq) <= 1
|
||||
&& square_rank(wksq) + tempo <= RANK_6
|
||||
&& (square_rank(brsq) == RANK_1 || (!tempo && abs(square_file(brsq) - f) >= 3)))
|
||||
&& rank_of(wksq) + tempo <= RANK_6
|
||||
&& (rank_of(brsq) == RANK_1 || (!tempo && abs(file_of(brsq) - f) >= 3)))
|
||||
return SCALE_FACTOR_ZERO;
|
||||
|
||||
if ( r >= RANK_6
|
||||
&& bksq == queeningSq
|
||||
&& square_rank(brsq) == RANK_1
|
||||
&& rank_of(brsq) == RANK_1
|
||||
&& (!tempo || square_distance(wksq, wpsq) >= 2))
|
||||
return SCALE_FACTOR_ZERO;
|
||||
|
||||
|
@ -562,8 +562,8 @@ ScaleFactor Endgame<KRPKR>::apply(const Position& pos) const {
|
|||
if ( wpsq == SQ_A7
|
||||
&& wrsq == SQ_A8
|
||||
&& (bksq == SQ_H7 || bksq == SQ_G7)
|
||||
&& square_file(brsq) == FILE_A
|
||||
&& (square_rank(brsq) <= RANK_3 || square_file(wksq) >= FILE_D || square_rank(wksq) <= RANK_5))
|
||||
&& file_of(brsq) == FILE_A
|
||||
&& (rank_of(brsq) <= RANK_3 || file_of(wksq) >= FILE_D || rank_of(wksq) <= RANK_5))
|
||||
return SCALE_FACTOR_ZERO;
|
||||
|
||||
// If the defending king blocks the pawn and the attacking king is too far
|
||||
|
@ -579,7 +579,7 @@ ScaleFactor Endgame<KRPKR>::apply(const Position& pos) const {
|
|||
// and the defending king cannot gain tempi by threatening the attacking rook.
|
||||
if ( r == RANK_7
|
||||
&& f != FILE_A
|
||||
&& square_file(wrsq) == f
|
||||
&& file_of(wrsq) == f
|
||||
&& wrsq != queeningSq
|
||||
&& (square_distance(wksq, queeningSq) < square_distance(bksq, queeningSq) - 2 + tempo)
|
||||
&& (square_distance(wksq, queeningSq) < square_distance(bksq, wrsq) + tempo))
|
||||
|
@ -587,7 +587,7 @@ ScaleFactor Endgame<KRPKR>::apply(const Position& pos) const {
|
|||
|
||||
// Similar to the above, but with the pawn further back
|
||||
if ( f != FILE_A
|
||||
&& square_file(wrsq) == f
|
||||
&& file_of(wrsq) == f
|
||||
&& wrsq < wpsq
|
||||
&& (square_distance(wksq, queeningSq) < square_distance(bksq, queeningSq) - 2 + tempo)
|
||||
&& (square_distance(wksq, wpsq + DELTA_N) < square_distance(bksq, wpsq + DELTA_N) - 2 + tempo)
|
||||
|
@ -602,9 +602,9 @@ ScaleFactor Endgame<KRPKR>::apply(const Position& pos) const {
|
|||
// the pawn's path, it's probably a draw.
|
||||
if (r <= RANK_4 && bksq > wpsq)
|
||||
{
|
||||
if (square_file(bksq) == square_file(wpsq))
|
||||
if (file_of(bksq) == file_of(wpsq))
|
||||
return ScaleFactor(10);
|
||||
if ( abs(square_file(bksq) - square_file(wpsq)) == 1
|
||||
if ( abs(file_of(bksq) - file_of(wpsq)) == 1
|
||||
&& square_distance(wksq, bksq) > 2)
|
||||
return ScaleFactor(24 - 2 * square_distance(wksq, bksq));
|
||||
}
|
||||
|
@ -670,7 +670,7 @@ ScaleFactor Endgame<KPsK>::apply(const Position& pos) const {
|
|||
{
|
||||
// Does the defending king block the pawns?
|
||||
if ( square_distance(ksq, relative_square(strongerSide, SQ_A8)) <= 1
|
||||
|| ( square_file(ksq) == FILE_A
|
||||
|| ( file_of(ksq) == FILE_A
|
||||
&& (in_front_bb(strongerSide, ksq) & pawns) == EmptyBoardBB))
|
||||
return SCALE_FACTOR_ZERO;
|
||||
}
|
||||
|
@ -679,7 +679,7 @@ ScaleFactor Endgame<KPsK>::apply(const Position& pos) const {
|
|||
{
|
||||
// Does the defending king block the pawns?
|
||||
if ( square_distance(ksq, relative_square(strongerSide, SQ_H8)) <= 1
|
||||
|| ( square_file(ksq) == FILE_H
|
||||
|| ( file_of(ksq) == FILE_H
|
||||
&& (in_front_bb(strongerSide, ksq) & pawns) == EmptyBoardBB))
|
||||
return SCALE_FACTOR_ZERO;
|
||||
}
|
||||
|
@ -708,7 +708,7 @@ ScaleFactor Endgame<KBPKB>::apply(const Position& pos) const {
|
|||
Square weakerKingSq = pos.king_square(weakerSide);
|
||||
|
||||
// Case 1: Defending king blocks the pawn, and cannot be driven away
|
||||
if ( square_file(weakerKingSq) == square_file(pawnSq)
|
||||
if ( file_of(weakerKingSq) == file_of(pawnSq)
|
||||
&& relative_rank(strongerSide, pawnSq) < relative_rank(strongerSide, weakerKingSq)
|
||||
&& ( opposite_color_squares(weakerKingSq, strongerBishopSq)
|
||||
|| relative_rank(strongerSide, weakerKingSq) <= RANK_6))
|
||||
|
@ -766,19 +766,19 @@ ScaleFactor Endgame<KBPPKB>::apply(const Position& pos) const {
|
|||
Square ksq = pos.king_square(weakerSide);
|
||||
Square psq1 = pos.piece_list(strongerSide, PAWN)[0];
|
||||
Square psq2 = pos.piece_list(strongerSide, PAWN)[1];
|
||||
Rank r1 = square_rank(psq1);
|
||||
Rank r2 = square_rank(psq2);
|
||||
Rank r1 = rank_of(psq1);
|
||||
Rank r2 = rank_of(psq2);
|
||||
Square blockSq1, blockSq2;
|
||||
|
||||
if (relative_rank(strongerSide, psq1) > relative_rank(strongerSide, psq2))
|
||||
{
|
||||
blockSq1 = psq1 + pawn_push(strongerSide);
|
||||
blockSq2 = make_square(square_file(psq2), square_rank(psq1));
|
||||
blockSq2 = make_square(file_of(psq2), rank_of(psq1));
|
||||
}
|
||||
else
|
||||
{
|
||||
blockSq1 = psq2 + pawn_push(strongerSide);
|
||||
blockSq2 = make_square(square_file(psq1), square_rank(psq2));
|
||||
blockSq2 = make_square(file_of(psq1), rank_of(psq2));
|
||||
}
|
||||
|
||||
switch (file_distance(psq1, psq2))
|
||||
|
@ -786,7 +786,7 @@ ScaleFactor Endgame<KBPPKB>::apply(const Position& pos) const {
|
|||
case 0:
|
||||
// Both pawns are on the same file. Easy draw if defender firmly controls
|
||||
// some square in the frontmost pawn's path.
|
||||
if ( square_file(ksq) == square_file(blockSq1)
|
||||
if ( file_of(ksq) == file_of(blockSq1)
|
||||
&& relative_rank(strongerSide, ksq) >= relative_rank(strongerSide, blockSq1)
|
||||
&& opposite_color_squares(ksq, wbsq))
|
||||
return SCALE_FACTOR_ZERO;
|
||||
|
@ -837,7 +837,7 @@ ScaleFactor Endgame<KBPKN>::apply(const Position& pos) const {
|
|||
Square strongerBishopSq = pos.piece_list(strongerSide, BISHOP)[0];
|
||||
Square weakerKingSq = pos.king_square(weakerSide);
|
||||
|
||||
if ( square_file(weakerKingSq) == square_file(pawnSq)
|
||||
if ( file_of(weakerKingSq) == file_of(pawnSq)
|
||||
&& relative_rank(strongerSide, pawnSq) < relative_rank(strongerSide, weakerKingSq)
|
||||
&& ( opposite_color_squares(weakerKingSq, strongerBishopSq)
|
||||
|| relative_rank(strongerSide, weakerKingSq) <= RANK_6))
|
||||
|
@ -900,23 +900,23 @@ ScaleFactor Endgame<KPKP>::apply(const Position& pos) const {
|
|||
}
|
||||
else
|
||||
{
|
||||
wksq = flip_square(pos.king_square(BLACK));
|
||||
bksq = flip_square(pos.king_square(WHITE));
|
||||
wpsq = flip_square(pos.piece_list(BLACK, PAWN)[0]);
|
||||
stm = opposite_color(pos.side_to_move());
|
||||
wksq = flip(pos.king_square(BLACK));
|
||||
bksq = flip(pos.king_square(WHITE));
|
||||
wpsq = flip(pos.piece_list(BLACK, PAWN)[0]);
|
||||
stm = flip(pos.side_to_move());
|
||||
}
|
||||
|
||||
if (square_file(wpsq) >= FILE_E)
|
||||
if (file_of(wpsq) >= FILE_E)
|
||||
{
|
||||
wksq = flop_square(wksq);
|
||||
bksq = flop_square(bksq);
|
||||
wpsq = flop_square(wpsq);
|
||||
wksq = mirror(wksq);
|
||||
bksq = mirror(bksq);
|
||||
wpsq = mirror(wpsq);
|
||||
}
|
||||
|
||||
// If the pawn has advanced to the fifth rank or further, and is not a
|
||||
// rook pawn, it's too dangerous to assume that it's at least a draw.
|
||||
if ( square_rank(wpsq) >= RANK_5
|
||||
&& square_file(wpsq) != FILE_A)
|
||||
if ( rank_of(wpsq) >= RANK_5
|
||||
&& file_of(wpsq) != FILE_A)
|
||||
return SCALE_FACTOR_NONE;
|
||||
|
||||
// Probe the KPK bitbase with the weakest side's pawn removed. If it's a
|
||||
|
|
|
@ -82,7 +82,7 @@ struct EndgameBase {
|
|||
template<EndgameType E, typename T = typename eg_family<E>::type>
|
||||
struct Endgame : public EndgameBase<T> {
|
||||
|
||||
explicit Endgame(Color c) : strongerSide(c), weakerSide(opposite_color(c)) {}
|
||||
explicit Endgame(Color c) : strongerSide(c), weakerSide(flip(c)) {}
|
||||
Color color() const { return strongerSide; }
|
||||
T apply(const Position&) const;
|
||||
|
||||
|
|
|
@ -546,7 +546,7 @@ namespace {
|
|||
// problem, especially when that pawn is also blocked.
|
||||
if (s == relative_square(Us, SQ_A1) || s == relative_square(Us, SQ_H1))
|
||||
{
|
||||
Square d = pawn_push(Us) + (square_file(s) == FILE_A ? DELTA_E : DELTA_W);
|
||||
Square d = pawn_push(Us) + (file_of(s) == FILE_A ? DELTA_E : DELTA_W);
|
||||
if (pos.piece_on(s + d) == make_piece(Us, PAWN))
|
||||
{
|
||||
if (!pos.square_is_empty(s + d + pawn_push(Us)))
|
||||
|
@ -563,7 +563,7 @@ namespace {
|
|||
if (Piece == ROOK)
|
||||
{
|
||||
// Open and half-open files
|
||||
f = square_file(s);
|
||||
f = file_of(s);
|
||||
if (ei.pi->file_is_half_open(Us, f))
|
||||
{
|
||||
if (ei.pi->file_is_half_open(Them, f))
|
||||
|
@ -579,21 +579,21 @@ namespace {
|
|||
|
||||
ksq = pos.king_square(Us);
|
||||
|
||||
if ( square_file(ksq) >= FILE_E
|
||||
&& square_file(s) > square_file(ksq)
|
||||
&& (relative_rank(Us, ksq) == RANK_1 || square_rank(ksq) == square_rank(s)))
|
||||
if ( file_of(ksq) >= FILE_E
|
||||
&& file_of(s) > file_of(ksq)
|
||||
&& (relative_rank(Us, ksq) == RANK_1 || rank_of(ksq) == rank_of(s)))
|
||||
{
|
||||
// Is there a half-open file between the king and the edge of the board?
|
||||
if (!ei.pi->has_open_file_to_right(Us, square_file(ksq)))
|
||||
if (!ei.pi->has_open_file_to_right(Us, file_of(ksq)))
|
||||
score -= make_score(pos.can_castle(Us) ? (TrappedRookPenalty - mob * 16) / 2
|
||||
: (TrappedRookPenalty - mob * 16), 0);
|
||||
}
|
||||
else if ( square_file(ksq) <= FILE_D
|
||||
&& square_file(s) < square_file(ksq)
|
||||
&& (relative_rank(Us, ksq) == RANK_1 || square_rank(ksq) == square_rank(s)))
|
||||
else if ( file_of(ksq) <= FILE_D
|
||||
&& file_of(s) < file_of(ksq)
|
||||
&& (relative_rank(Us, ksq) == RANK_1 || rank_of(ksq) == rank_of(s)))
|
||||
{
|
||||
// Is there a half-open file between the king and the edge of the board?
|
||||
if (!ei.pi->has_open_file_to_left(Us, square_file(ksq)))
|
||||
if (!ei.pi->has_open_file_to_left(Us, file_of(ksq)))
|
||||
score -= make_score(pos.can_castle(Us) ? (TrappedRookPenalty - mob * 16) / 2
|
||||
: (TrappedRookPenalty - mob * 16), 0);
|
||||
}
|
||||
|
@ -816,7 +816,7 @@ namespace {
|
|||
ebonus -= Value(square_distance(pos.king_square(Us), blockSq) * 3 * rr);
|
||||
|
||||
// If blockSq is not the queening square then consider also a second push
|
||||
if (square_rank(blockSq) != (Us == WHITE ? RANK_8 : RANK_1))
|
||||
if (rank_of(blockSq) != (Us == WHITE ? RANK_8 : RANK_1))
|
||||
ebonus -= Value(square_distance(pos.king_square(Us), blockSq + pawn_push(Us)) * rr);
|
||||
|
||||
// If the pawn is free to advance, increase bonus
|
||||
|
@ -866,7 +866,7 @@ namespace {
|
|||
// we try the following: Increase the value for rook pawns if the
|
||||
// other side has no pieces apart from a knight, and decrease the
|
||||
// value if the other side has a rook or queen.
|
||||
if (square_file(s) == FILE_A || square_file(s) == FILE_H)
|
||||
if (file_of(s) == FILE_A || file_of(s) == FILE_H)
|
||||
{
|
||||
if (pos.non_pawn_material(Them) <= KnightValueMidgame)
|
||||
ebonus += ebonus / 4;
|
||||
|
@ -902,7 +902,7 @@ namespace {
|
|||
for (c = WHITE; c <= BLACK; c++)
|
||||
{
|
||||
// Skip if other side has non-pawn pieces
|
||||
if (pos.non_pawn_material(opposite_color(c)))
|
||||
if (pos.non_pawn_material(flip(c)))
|
||||
continue;
|
||||
|
||||
b = ei.pi->passed_pawns(c);
|
||||
|
@ -910,12 +910,12 @@ namespace {
|
|||
while (b)
|
||||
{
|
||||
s = pop_1st_bit(&b);
|
||||
queeningSquare = relative_square(c, make_square(square_file(s), RANK_8));
|
||||
queeningSquare = relative_square(c, make_square(file_of(s), RANK_8));
|
||||
queeningPath = squares_in_front_of(c, s);
|
||||
|
||||
// Compute plies to queening and check direct advancement
|
||||
movesToGo = rank_distance(s, queeningSquare) - int(relative_rank(c, s) == RANK_2);
|
||||
oppMovesToGo = square_distance(pos.king_square(opposite_color(c)), queeningSquare) - int(c != pos.side_to_move());
|
||||
oppMovesToGo = square_distance(pos.king_square(flip(c)), queeningSquare) - int(c != pos.side_to_move());
|
||||
pathDefended = ((ei.attackedBy[c][0] & queeningPath) == queeningPath);
|
||||
|
||||
if (movesToGo >= oppMovesToGo && !pathDefended)
|
||||
|
@ -943,7 +943,7 @@ namespace {
|
|||
return SCORE_ZERO;
|
||||
|
||||
winnerSide = (pliesToQueen[WHITE] < pliesToQueen[BLACK] ? WHITE : BLACK);
|
||||
loserSide = opposite_color(winnerSide);
|
||||
loserSide = flip(winnerSide);
|
||||
|
||||
// Step 3. Can the losing side possibly create a new passed pawn and thus prevent the loss?
|
||||
b = candidates = pos.pieces(PAWN, loserSide);
|
||||
|
@ -953,7 +953,7 @@ namespace {
|
|||
s = pop_1st_bit(&b);
|
||||
|
||||
// Compute plies from queening
|
||||
queeningSquare = relative_square(loserSide, make_square(square_file(s), RANK_8));
|
||||
queeningSquare = relative_square(loserSide, make_square(file_of(s), RANK_8));
|
||||
movesToGo = rank_distance(s, queeningSquare) - int(relative_rank(loserSide, s) == RANK_2);
|
||||
pliesToGo = 2 * movesToGo - int(loserSide == pos.side_to_move());
|
||||
|
||||
|
@ -977,7 +977,7 @@ namespace {
|
|||
minKingDist = kingptg = 256;
|
||||
|
||||
// Compute plies from queening
|
||||
queeningSquare = relative_square(loserSide, make_square(square_file(s), RANK_8));
|
||||
queeningSquare = relative_square(loserSide, make_square(file_of(s), RANK_8));
|
||||
movesToGo = rank_distance(s, queeningSquare) - int(relative_rank(loserSide, s) == RANK_2);
|
||||
pliesToGo = 2 * movesToGo - int(loserSide == pos.side_to_move());
|
||||
|
||||
|
|
14
src/move.cpp
14
src/move.cpp
|
@ -45,7 +45,7 @@ const string move_to_uci(Move m, bool chess960) {
|
|||
return "0000";
|
||||
|
||||
if (move_is_castle(m) && !chess960)
|
||||
to = from + (square_file(to) == FILE_H ? Square(2) : -Square(2));
|
||||
to = from + (file_of(to) == FILE_H ? Square(2) : -Square(2));
|
||||
|
||||
if (move_is_promotion(m))
|
||||
promotion = char(tolower(piece_type_to_char(promotion_piece_type(m))));
|
||||
|
@ -86,7 +86,7 @@ const string move_to_san(Position& pos, Move m) {
|
|||
bool ambiguousMove, ambiguousFile, ambiguousRank;
|
||||
Square sq, from = move_from(m);
|
||||
Square to = move_to(m);
|
||||
PieceType pt = piece_type(pos.piece_on(from));
|
||||
PieceType pt = type_of(pos.piece_on(from));
|
||||
string san;
|
||||
|
||||
if (move_is_castle(m))
|
||||
|
@ -107,10 +107,10 @@ const string move_to_san(Position& pos, Move m) {
|
|||
{
|
||||
sq = pop_1st_bit(&attackers);
|
||||
|
||||
if (square_file(sq) == square_file(from))
|
||||
if (file_of(sq) == file_of(from))
|
||||
ambiguousFile = true;
|
||||
|
||||
if (square_rank(sq) == square_rank(from))
|
||||
if (rank_of(sq) == rank_of(from))
|
||||
ambiguousRank = true;
|
||||
|
||||
ambiguousMove = true;
|
||||
|
@ -119,9 +119,9 @@ const string move_to_san(Position& pos, Move m) {
|
|||
if (ambiguousMove)
|
||||
{
|
||||
if (!ambiguousFile)
|
||||
san += file_to_char(square_file(from));
|
||||
san += file_to_char(file_of(from));
|
||||
else if (!ambiguousRank)
|
||||
san += rank_to_char(square_rank(from));
|
||||
san += rank_to_char(rank_of(from));
|
||||
else
|
||||
san += square_to_string(from);
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ const string move_to_san(Position& pos, Move m) {
|
|||
if (pos.move_is_capture(m))
|
||||
{
|
||||
if (pt == PAWN)
|
||||
san += file_to_char(square_file(from));
|
||||
san += file_to_char(file_of(from));
|
||||
|
||||
san += 'x';
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace {
|
|||
Bitboard b = pos.attacks_from<Pt>(from) & pos.empty_squares();
|
||||
|
||||
if (Pt == KING)
|
||||
b &= ~QueenPseudoAttacks[pos.king_square(opposite_color(pos.side_to_move()))];
|
||||
b &= ~QueenPseudoAttacks[pos.king_square(flip(pos.side_to_move()))];
|
||||
|
||||
SERIALIZE_MOVES(b);
|
||||
return mlist;
|
||||
|
@ -158,7 +158,7 @@ MoveStack* generate(const Position& pos, MoveStack* mlist) {
|
|||
Bitboard target;
|
||||
|
||||
if (Type == MV_CAPTURE || Type == MV_NON_EVASION)
|
||||
target = pos.pieces(opposite_color(us));
|
||||
target = pos.pieces(flip(us));
|
||||
else if (Type == MV_NON_CAPTURE)
|
||||
target = pos.empty_squares();
|
||||
else
|
||||
|
@ -207,9 +207,9 @@ MoveStack* generate<MV_NON_CAPTURE_CHECK>(const Position& pos, MoveStack* mlist)
|
|||
Bitboard b, dc;
|
||||
Square from;
|
||||
Color us = pos.side_to_move();
|
||||
Square ksq = pos.king_square(opposite_color(us));
|
||||
Square ksq = pos.king_square(flip(us));
|
||||
|
||||
assert(pos.piece_on(ksq) == make_piece(opposite_color(us), KING));
|
||||
assert(pos.piece_on(ksq) == make_piece(flip(us), KING));
|
||||
|
||||
// Discovered non-capture checks
|
||||
b = dc = pos.discovered_check_candidates();
|
||||
|
@ -217,7 +217,7 @@ MoveStack* generate<MV_NON_CAPTURE_CHECK>(const Position& pos, MoveStack* mlist)
|
|||
while (b)
|
||||
{
|
||||
from = pop_1st_bit(&b);
|
||||
switch (piece_type(pos.piece_on(from)))
|
||||
switch (type_of(pos.piece_on(from)))
|
||||
{
|
||||
case PAWN: /* Will be generated togheter with pawns direct checks */ break;
|
||||
case KNIGHT: mlist = generate_discovered_checks<KNIGHT>(pos, mlist, from); break;
|
||||
|
@ -264,9 +264,9 @@ MoveStack* generate<MV_EVASION>(const Position& pos, MoveStack* mlist) {
|
|||
checkersCnt++;
|
||||
checksq = pop_1st_bit(&b);
|
||||
|
||||
assert(piece_color(pos.piece_on(checksq)) == opposite_color(us));
|
||||
assert(color_of(pos.piece_on(checksq)) == flip(us));
|
||||
|
||||
switch (piece_type(pos.piece_on(checksq)))
|
||||
switch (type_of(pos.piece_on(checksq)))
|
||||
{
|
||||
case BISHOP: sliderAttacks |= BishopPseudoAttacks[checksq]; break;
|
||||
case ROOK: sliderAttacks |= RookPseudoAttacks[checksq]; break;
|
||||
|
@ -473,8 +473,8 @@ namespace {
|
|||
// En passant captures
|
||||
if ((Type == MV_CAPTURE || Type == MV_EVASION) && pos.ep_square() != SQ_NONE)
|
||||
{
|
||||
assert(Us != WHITE || square_rank(pos.ep_square()) == RANK_6);
|
||||
assert(Us != BLACK || square_rank(pos.ep_square()) == RANK_3);
|
||||
assert(Us != WHITE || rank_of(pos.ep_square()) == RANK_6);
|
||||
assert(Us != BLACK || rank_of(pos.ep_square()) == RANK_3);
|
||||
|
||||
// An en passant capture can be an evasion only if the checking piece
|
||||
// is the double pushed pawn and so is in the target. Otherwise this
|
||||
|
@ -499,7 +499,7 @@ namespace {
|
|||
MoveStack* generate_castle_moves(const Position& pos, MoveStack* mlist, Color us) {
|
||||
|
||||
CastleRight f = CastleRight((Side == KING_SIDE ? WHITE_OO : WHITE_OOO) << us);
|
||||
Color them = opposite_color(us);
|
||||
Color them = flip(us);
|
||||
|
||||
// After castling, the rook and king's final positions are exactly the same
|
||||
// in Chess960 as they would be in standard chess.
|
||||
|
|
|
@ -252,7 +252,7 @@ void MovePicker::score_captures() {
|
|||
{
|
||||
m = cur->move;
|
||||
cur->score = piece_value_midgame(pos.piece_on(move_to(m)))
|
||||
- piece_type(pos.piece_on(move_from(m)));
|
||||
- type_of(pos.piece_on(move_from(m)));
|
||||
|
||||
if (move_is_promotion(m))
|
||||
cur->score += piece_value_midgame(Piece(promotion_piece_type(m)));
|
||||
|
@ -291,7 +291,7 @@ void MovePicker::score_evasions() {
|
|||
cur->score = seeScore - History::MaxValue; // Be sure we are at the bottom
|
||||
else if (pos.move_is_capture(m))
|
||||
cur->score = piece_value_midgame(pos.piece_on(move_to(m)))
|
||||
- piece_type(pos.piece_on(move_from(m))) + History::MaxValue;
|
||||
- type_of(pos.piece_on(move_from(m))) + History::MaxValue;
|
||||
else
|
||||
cur->score = H.value(pos.piece_on(move_from(m)), move_to(m));
|
||||
}
|
||||
|
|
|
@ -132,8 +132,8 @@ Score PawnInfoTable::evaluate_pawns(const Position& pos, Bitboard ourPawns,
|
|||
{
|
||||
assert(pos.piece_on(s) == make_piece(Us, PAWN));
|
||||
|
||||
f = square_file(s);
|
||||
r = square_rank(s);
|
||||
f = file_of(s);
|
||||
r = rank_of(s);
|
||||
|
||||
// This file cannot be half open
|
||||
pi->halfOpenFiles[Us] &= ~(1 << f);
|
||||
|
|
149
src/position.cpp
149
src/position.cpp
|
@ -77,7 +77,7 @@ namespace {
|
|||
|
||||
CheckInfo::CheckInfo(const Position& pos) {
|
||||
|
||||
Color them = opposite_color(pos.side_to_move());
|
||||
Color them = flip(pos.side_to_move());
|
||||
Square ksq = pos.king_square(them);
|
||||
|
||||
pinned = pos.pinned_pieces();
|
||||
|
@ -183,7 +183,7 @@ void Position::from_fen(const string& fenStr, bool isChess960) {
|
|||
&& ((fen >> row) && (row == '3' || row == '6')))
|
||||
{
|
||||
st->epSquare = make_square(File(col - 'a'), Rank(row - '1'));
|
||||
Color them = opposite_color(sideToMove);
|
||||
Color them = flip(sideToMove);
|
||||
|
||||
if (!(attacks_from<PAWN>(st->epSquare, them) & pieces(PAWN, sideToMove)))
|
||||
st->epSquare = SQ_NONE;
|
||||
|
@ -198,7 +198,7 @@ void Position::from_fen(const string& fenStr, bool isChess960) {
|
|||
|
||||
// Various initialisations
|
||||
chess960 = isChess960;
|
||||
st->checkersBB = attackers_to(king_square(sideToMove)) & pieces(opposite_color(sideToMove));
|
||||
st->checkersBB = attackers_to(king_square(sideToMove)) & pieces(flip(sideToMove));
|
||||
|
||||
st->key = compute_key();
|
||||
st->pawnKey = compute_pawn_key();
|
||||
|
@ -251,7 +251,7 @@ void Position::set_castling_rights(char token) {
|
|||
|
||||
else return;
|
||||
|
||||
if (square_file(rsq) < square_file(ksq))
|
||||
if (file_of(rsq) < file_of(ksq))
|
||||
set_castle(WHITE_OOO << c, ksq, rsq);
|
||||
else
|
||||
set_castle(WHITE_OO << c, ksq, rsq);
|
||||
|
@ -300,16 +300,16 @@ const string Position::to_fen() const {
|
|||
if (st->castleRights != CASTLES_NONE)
|
||||
{
|
||||
if (can_castle(WHITE_OO))
|
||||
fen << (chess960 ? char(toupper(file_to_char(square_file(castle_rook_square(WHITE_OO))))) : 'K');
|
||||
fen << (chess960 ? char(toupper(file_to_char(file_of(castle_rook_square(WHITE_OO))))) : 'K');
|
||||
|
||||
if (can_castle(WHITE_OOO))
|
||||
fen << (chess960 ? char(toupper(file_to_char(square_file(castle_rook_square(WHITE_OOO))))) : 'Q');
|
||||
fen << (chess960 ? char(toupper(file_to_char(file_of(castle_rook_square(WHITE_OOO))))) : 'Q');
|
||||
|
||||
if (can_castle(BLACK_OO))
|
||||
fen << (chess960 ? file_to_char(square_file(castle_rook_square(BLACK_OO))) : 'k');
|
||||
fen << (chess960 ? file_to_char(file_of(castle_rook_square(BLACK_OO))) : 'k');
|
||||
|
||||
if (can_castle(BLACK_OOO))
|
||||
fen << (chess960 ? file_to_char(square_file(castle_rook_square(BLACK_OOO))) : 'q');
|
||||
fen << (chess960 ? file_to_char(file_of(castle_rook_square(BLACK_OOO))) : 'q');
|
||||
} else
|
||||
fen << '-';
|
||||
|
||||
|
@ -345,7 +345,7 @@ void Position::print(Move move) const {
|
|||
if (piece == PIECE_NONE && square_color(sq) == DARK)
|
||||
piece = PIECE_NONE_DARK_SQ;
|
||||
|
||||
char c = (piece_color(piece_on(sq)) == BLACK ? '=' : ' ');
|
||||
char c = (color_of(piece_on(sq)) == BLACK ? '=' : ' ');
|
||||
cout << c << PieceToChar[piece] << c << '|';
|
||||
}
|
||||
}
|
||||
|
@ -363,8 +363,8 @@ Bitboard Position::hidden_checkers() const {
|
|||
|
||||
// Pinned pieces protect our king, dicovery checks attack the enemy king
|
||||
Bitboard b, result = EmptyBoardBB;
|
||||
Bitboard pinners = pieces(FindPinned ? opposite_color(sideToMove) : sideToMove);
|
||||
Square ksq = king_square(FindPinned ? sideToMove : opposite_color(sideToMove));
|
||||
Bitboard pinners = pieces(FindPinned ? flip(sideToMove) : sideToMove);
|
||||
Square ksq = king_square(FindPinned ? sideToMove : flip(sideToMove));
|
||||
|
||||
// Pinners are sliders, that give check when candidate pinned is removed
|
||||
pinners &= (pieces(ROOK, QUEEN) & RookPseudoAttacks[ksq])
|
||||
|
@ -474,7 +474,7 @@ bool Position::move_attacks_square(Move m, Square s) const {
|
|||
do_move_bb(&occ, make_move_bb(f, t));
|
||||
xray = ( (rook_attacks_bb(s, occ) & pieces(ROOK, QUEEN))
|
||||
|(bishop_attacks_bb(s, occ) & pieces(BISHOP, QUEEN)))
|
||||
& pieces(piece_color(piece_on(f)));
|
||||
& pieces(color_of(piece_on(f)));
|
||||
|
||||
// If we have attacks we need to verify that are caused by our move
|
||||
// and are not already existent ones.
|
||||
|
@ -492,7 +492,7 @@ bool Position::pl_move_is_legal(Move m, Bitboard pinned) const {
|
|||
Color us = side_to_move();
|
||||
Square from = move_from(m);
|
||||
|
||||
assert(piece_color(piece_on(from)) == us);
|
||||
assert(color_of(piece_on(from)) == us);
|
||||
assert(piece_on(king_square(us)) == make_piece(us, KING));
|
||||
|
||||
// En passant captures are a tricky special case. Because they are rather
|
||||
|
@ -500,7 +500,7 @@ bool Position::pl_move_is_legal(Move m, Bitboard pinned) const {
|
|||
// the move is made.
|
||||
if (move_is_ep(m))
|
||||
{
|
||||
Color them = opposite_color(us);
|
||||
Color them = flip(us);
|
||||
Square to = move_to(m);
|
||||
Square capsq = to + pawn_push(them);
|
||||
Square ksq = king_square(us);
|
||||
|
@ -522,8 +522,8 @@ bool Position::pl_move_is_legal(Move m, Bitboard pinned) const {
|
|||
// If the moving piece is a king, check whether the destination
|
||||
// square is attacked by the opponent. Castling moves are checked
|
||||
// for legality during move generation.
|
||||
if (piece_type(piece_on(from)) == KING)
|
||||
return move_is_castle(m) || !(attackers_to(move_to(m)) & pieces(opposite_color(us)));
|
||||
if (type_of(piece_on(from)) == KING)
|
||||
return move_is_castle(m) || !(attackers_to(move_to(m)) & pieces(flip(us)));
|
||||
|
||||
// A non-king move is legal if and only if it is not pinned or it
|
||||
// is moving along the ray towards or away from the king.
|
||||
|
@ -553,7 +553,7 @@ bool Position::move_is_legal(const Move m) const {
|
|||
bool Position::move_is_pl(const Move m) const {
|
||||
|
||||
Color us = sideToMove;
|
||||
Color them = opposite_color(sideToMove);
|
||||
Color them = flip(sideToMove);
|
||||
Square from = move_from(m);
|
||||
Square to = move_to(m);
|
||||
Piece pc = piece_on(from);
|
||||
|
@ -568,15 +568,15 @@ bool Position::move_is_pl(const Move m) const {
|
|||
|
||||
// If the from square is not occupied by a piece belonging to the side to
|
||||
// move, the move is obviously not legal.
|
||||
if (pc == PIECE_NONE || piece_color(pc) != us)
|
||||
if (pc == PIECE_NONE || color_of(pc) != us)
|
||||
return false;
|
||||
|
||||
// The destination square cannot be occupied by a friendly piece
|
||||
if (piece_color(piece_on(to)) == us)
|
||||
if (color_of(piece_on(to)) == us)
|
||||
return false;
|
||||
|
||||
// Handle the special case of a pawn move
|
||||
if (piece_type(pc) == PAWN)
|
||||
if (type_of(pc) == PAWN)
|
||||
{
|
||||
// Move direction must be compatible with pawn color
|
||||
int direction = to - from;
|
||||
|
@ -585,7 +585,7 @@ bool Position::move_is_pl(const Move m) const {
|
|||
|
||||
// We have already handled promotion moves, so destination
|
||||
// cannot be on the 8/1th rank.
|
||||
if (square_rank(to) == RANK_8 || square_rank(to) == RANK_1)
|
||||
if (rank_of(to) == RANK_8 || rank_of(to) == RANK_1)
|
||||
return false;
|
||||
|
||||
// Proceed according to the square delta between the origin and
|
||||
|
@ -598,11 +598,11 @@ bool Position::move_is_pl(const Move m) const {
|
|||
case DELTA_SE:
|
||||
// Capture. The destination square must be occupied by an enemy
|
||||
// piece (en passant captures was handled earlier).
|
||||
if (piece_color(piece_on(to)) != them)
|
||||
if (color_of(piece_on(to)) != them)
|
||||
return false;
|
||||
|
||||
// From and to files must be one file apart, avoids a7h5
|
||||
if (abs(square_file(from) - square_file(to)) != 1)
|
||||
if (abs(file_of(from) - file_of(to)) != 1)
|
||||
return false;
|
||||
break;
|
||||
|
||||
|
@ -617,7 +617,7 @@ bool Position::move_is_pl(const Move m) const {
|
|||
// Double white pawn push. The destination square must be on the fourth
|
||||
// rank, and both the destination square and the square between the
|
||||
// source and destination squares must be empty.
|
||||
if ( square_rank(to) != RANK_4
|
||||
if ( rank_of(to) != RANK_4
|
||||
|| !square_is_empty(to)
|
||||
|| !square_is_empty(from + DELTA_N))
|
||||
return false;
|
||||
|
@ -627,7 +627,7 @@ bool Position::move_is_pl(const Move m) const {
|
|||
// Double black pawn push. The destination square must be on the fifth
|
||||
// rank, and both the destination square and the square between the
|
||||
// source and destination squares must be empty.
|
||||
if ( square_rank(to) != RANK_5
|
||||
if ( rank_of(to) != RANK_5
|
||||
|| !square_is_empty(to)
|
||||
|| !square_is_empty(from + DELTA_S))
|
||||
return false;
|
||||
|
@ -644,11 +644,11 @@ bool Position::move_is_pl(const Move m) const {
|
|||
{
|
||||
// In case of king moves under check we have to remove king so to catch
|
||||
// as invalid moves like b1a1 when opposite queen is on c1.
|
||||
if (piece_type(piece_on(from)) == KING)
|
||||
if (type_of(piece_on(from)) == KING)
|
||||
{
|
||||
Bitboard b = occupied_squares();
|
||||
clear_bit(&b, from);
|
||||
if (attackers_to(move_to(m), b) & pieces(opposite_color(us)))
|
||||
if (attackers_to(move_to(m), b) & pieces(flip(us)))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
@ -676,11 +676,11 @@ bool Position::move_gives_check(Move m, const CheckInfo& ci) const {
|
|||
|
||||
assert(move_is_ok(m));
|
||||
assert(ci.dcCandidates == discovered_check_candidates());
|
||||
assert(piece_color(piece_on(move_from(m))) == side_to_move());
|
||||
assert(color_of(piece_on(move_from(m))) == side_to_move());
|
||||
|
||||
Square from = move_from(m);
|
||||
Square to = move_to(m);
|
||||
PieceType pt = piece_type(piece_on(from));
|
||||
PieceType pt = type_of(piece_on(from));
|
||||
|
||||
// Direct check ?
|
||||
if (bit_is_set(ci.checkSq[pt], to))
|
||||
|
@ -691,7 +691,7 @@ bool Position::move_gives_check(Move m, const CheckInfo& ci) const {
|
|||
{
|
||||
// For pawn and king moves we need to verify also direction
|
||||
if ( (pt != PAWN && pt != KING)
|
||||
|| !squares_aligned(from, to, king_square(opposite_color(side_to_move()))))
|
||||
|| !squares_aligned(from, to, king_square(flip(side_to_move()))))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -701,7 +701,7 @@ bool Position::move_gives_check(Move m, const CheckInfo& ci) const {
|
|||
|
||||
Color us = side_to_move();
|
||||
Bitboard b = occupied_squares();
|
||||
Square ksq = king_square(opposite_color(us));
|
||||
Square ksq = king_square(flip(us));
|
||||
|
||||
// Promotion with check ?
|
||||
if (move_is_promotion(m))
|
||||
|
@ -729,7 +729,7 @@ bool Position::move_gives_check(Move m, const CheckInfo& ci) const {
|
|||
// the captured pawn.
|
||||
if (move_is_ep(m))
|
||||
{
|
||||
Square capsq = make_square(square_file(to), square_rank(from));
|
||||
Square capsq = make_square(file_of(to), rank_of(from));
|
||||
clear_bit(&b, from);
|
||||
clear_bit(&b, capsq);
|
||||
set_bit(&b, to);
|
||||
|
@ -813,18 +813,18 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI
|
|||
}
|
||||
|
||||
Color us = side_to_move();
|
||||
Color them = opposite_color(us);
|
||||
Color them = flip(us);
|
||||
Square from = move_from(m);
|
||||
Square to = move_to(m);
|
||||
bool ep = move_is_ep(m);
|
||||
bool pm = move_is_promotion(m);
|
||||
|
||||
Piece piece = piece_on(from);
|
||||
PieceType pt = piece_type(piece);
|
||||
PieceType capture = ep ? PAWN : piece_type(piece_on(to));
|
||||
PieceType pt = type_of(piece);
|
||||
PieceType capture = ep ? PAWN : type_of(piece_on(to));
|
||||
|
||||
assert(piece_color(piece_on(from)) == us);
|
||||
assert(piece_color(piece_on(to)) == them || square_is_empty(to));
|
||||
assert(color_of(piece_on(from)) == us);
|
||||
assert(color_of(piece_on(to)) == them || square_is_empty(to));
|
||||
assert(!(ep || pm) || piece == make_piece(us, PAWN));
|
||||
assert(!pm || relative_rank(us, to) == RANK_8);
|
||||
|
||||
|
@ -967,7 +967,7 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI
|
|||
}
|
||||
|
||||
// Finish
|
||||
sideToMove = opposite_color(sideToMove);
|
||||
sideToMove = flip(sideToMove);
|
||||
st->value += (sideToMove == WHITE ? TempoValue : -TempoValue);
|
||||
|
||||
assert(is_ok());
|
||||
|
@ -992,7 +992,7 @@ void Position::do_capture_move(Key& key, PieceType capture, Color them, Square t
|
|||
capsq = to + pawn_push(them);
|
||||
|
||||
assert(to == st->epSquare);
|
||||
assert(relative_rank(opposite_color(them), to) == RANK_6);
|
||||
assert(relative_rank(flip(them), to) == RANK_6);
|
||||
assert(piece_on(to) == PIECE_NONE);
|
||||
assert(piece_on(capsq) == make_piece(them, PAWN));
|
||||
|
||||
|
@ -1048,7 +1048,7 @@ void Position::do_castle_move(Move m) {
|
|||
assert(move_is_castle(m));
|
||||
|
||||
Color us = side_to_move();
|
||||
Color them = opposite_color(us);
|
||||
Color them = flip(us);
|
||||
|
||||
// Find source squares for king and rook
|
||||
Square kfrom = move_from(m);
|
||||
|
@ -1130,7 +1130,7 @@ void Position::do_castle_move(Move m) {
|
|||
st->checkersBB = attackers_to(king_square(them)) & pieces(us);
|
||||
|
||||
// Finish
|
||||
sideToMove = opposite_color(sideToMove);
|
||||
sideToMove = flip(sideToMove);
|
||||
st->value += (sideToMove == WHITE ? TempoValue : -TempoValue);
|
||||
|
||||
assert(is_ok());
|
||||
|
@ -1144,7 +1144,7 @@ void Position::undo_move(Move m) {
|
|||
|
||||
assert(move_is_ok(m));
|
||||
|
||||
sideToMove = opposite_color(sideToMove);
|
||||
sideToMove = flip(sideToMove);
|
||||
|
||||
if (move_is_castle(m))
|
||||
{
|
||||
|
@ -1153,16 +1153,16 @@ void Position::undo_move(Move m) {
|
|||
}
|
||||
|
||||
Color us = side_to_move();
|
||||
Color them = opposite_color(us);
|
||||
Color them = flip(us);
|
||||
Square from = move_from(m);
|
||||
Square to = move_to(m);
|
||||
bool ep = move_is_ep(m);
|
||||
bool pm = move_is_promotion(m);
|
||||
|
||||
PieceType pt = piece_type(piece_on(to));
|
||||
PieceType pt = type_of(piece_on(to));
|
||||
|
||||
assert(square_is_empty(from));
|
||||
assert(piece_color(piece_on(to)) == us);
|
||||
assert(color_of(piece_on(to)) == us);
|
||||
assert(!pm || relative_rank(us, to) == RANK_8);
|
||||
assert(!ep || to == st->previous->epSquare);
|
||||
assert(!ep || relative_rank(us, to) == RANK_6);
|
||||
|
@ -1335,7 +1335,7 @@ void Position::do_null_move(StateInfo& backupSt) {
|
|||
st->key ^= zobSideToMove;
|
||||
prefetch((char*)TT.first_entry(st->key));
|
||||
|
||||
sideToMove = opposite_color(sideToMove);
|
||||
sideToMove = flip(sideToMove);
|
||||
st->epSquare = SQ_NONE;
|
||||
st->rule50++;
|
||||
st->pliesFromNull = 0;
|
||||
|
@ -1360,7 +1360,7 @@ void Position::undo_null_move() {
|
|||
st->pliesFromNull = backupSt->pliesFromNull;
|
||||
|
||||
// Update the necessary information
|
||||
sideToMove = opposite_color(sideToMove);
|
||||
sideToMove = flip(sideToMove);
|
||||
st->rule50--;
|
||||
|
||||
assert(is_ok());
|
||||
|
@ -1407,16 +1407,16 @@ int Position::see(Move m) const {
|
|||
|
||||
from = move_from(m);
|
||||
to = move_to(m);
|
||||
capturedType = piece_type(piece_on(to));
|
||||
capturedType = type_of(piece_on(to));
|
||||
occupied = occupied_squares();
|
||||
|
||||
// Handle en passant moves
|
||||
if (st->epSquare == to && piece_type(piece_on(from)) == PAWN)
|
||||
if (st->epSquare == to && type_of(piece_on(from)) == PAWN)
|
||||
{
|
||||
Square capQq = to - pawn_push(side_to_move());
|
||||
|
||||
assert(capturedType == PIECE_TYPE_NONE);
|
||||
assert(piece_type(piece_on(capQq)) == PAWN);
|
||||
assert(type_of(piece_on(capQq)) == PAWN);
|
||||
|
||||
// Remove the captured pawn
|
||||
clear_bit(&occupied, capQq);
|
||||
|
@ -1429,7 +1429,7 @@ int Position::see(Move m) const {
|
|||
attackers = attackers_to(to, occupied);
|
||||
|
||||
// If the opponent has no attackers we are finished
|
||||
stm = opposite_color(piece_color(piece_on(from)));
|
||||
stm = flip(color_of(piece_on(from)));
|
||||
stmAttackers = attackers & pieces(stm);
|
||||
if (!stmAttackers)
|
||||
return PieceValueMidgame[capturedType];
|
||||
|
@ -1441,7 +1441,7 @@ int Position::see(Move m) const {
|
|||
// capture with the least valuable piece. After each capture, we look for
|
||||
// new X-ray attacks from behind the capturing piece.
|
||||
swapList[0] = PieceValueMidgame[capturedType];
|
||||
capturedType = piece_type(piece_on(from));
|
||||
capturedType = type_of(piece_on(from));
|
||||
|
||||
do {
|
||||
// Locate the least valuable attacker for the side to move. The loop
|
||||
|
@ -1467,7 +1467,7 @@ int Position::see(Move m) const {
|
|||
// Remember the value of the capturing piece, and change the side to
|
||||
// move before beginning the next iteration.
|
||||
capturedType = pt;
|
||||
stm = opposite_color(stm);
|
||||
stm = flip(stm);
|
||||
stmAttackers = attackers & pieces(stm);
|
||||
|
||||
// Stop before processing a king capture
|
||||
|
@ -1521,8 +1521,8 @@ void Position::clear() {
|
|||
|
||||
void Position::put_piece(Piece p, Square s) {
|
||||
|
||||
Color c = piece_color(p);
|
||||
PieceType pt = piece_type(p);
|
||||
Color c = color_of(p);
|
||||
PieceType pt = type_of(p);
|
||||
|
||||
board[s] = p;
|
||||
index[s] = pieceCount[c][pt]++;
|
||||
|
@ -1545,7 +1545,7 @@ Key Position::compute_key() const {
|
|||
|
||||
for (Square s = SQ_A1; s <= SQ_H8; s++)
|
||||
if (!square_is_empty(s))
|
||||
result ^= zobrist[piece_color(piece_on(s))][piece_type(piece_on(s))][s];
|
||||
result ^= zobrist[color_of(piece_on(s))][type_of(piece_on(s))][s];
|
||||
|
||||
if (ep_square() != SQ_NONE)
|
||||
result ^= zobEp[ep_square()];
|
||||
|
@ -1692,7 +1692,7 @@ bool Position::is_mate() const {
|
|||
/// startup the various arrays used to compute hash keys and the piece
|
||||
/// square tables. The latter is a two-step operation: First, the white
|
||||
/// halves of the tables are copied from the MgPST[][] and EgPST[][] arrays.
|
||||
/// Second, the black halves of the tables are initialized by mirroring
|
||||
/// Second, the black halves of the tables are initialized by flipping
|
||||
/// and changing the sign of the corresponding white scores.
|
||||
|
||||
void Position::init() {
|
||||
|
@ -1713,20 +1713,19 @@ void Position::init() {
|
|||
zobSideToMove = rk.rand<Key>();
|
||||
zobExclusion = rk.rand<Key>();
|
||||
|
||||
for (Square s = SQ_A1; s <= SQ_H8; s++)
|
||||
for (Piece p = WP; p <= WK; p++)
|
||||
pieceSquareTable[p][s] = make_score(MgPST[p][s], EgPST[p][s]);
|
||||
|
||||
for (Square s = SQ_A1; s <= SQ_H8; s++)
|
||||
for (Piece p = BP; p <= BK; p++)
|
||||
pieceSquareTable[p][s] = -pieceSquareTable[p-8][flip_square(s)];
|
||||
{
|
||||
pieceSquareTable[p][s] = make_score(MgPST[p][s], EgPST[p][s]);
|
||||
pieceSquareTable[p+8][flip(s)] = -pieceSquareTable[p][s];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Position::flip() flips position with the white and black sides reversed. This
|
||||
/// Position::flip_me() flips position with the white and black sides reversed. This
|
||||
/// is only useful for debugging especially for finding evaluation symmetry bugs.
|
||||
|
||||
void Position::flip() {
|
||||
void Position::flip_me() {
|
||||
|
||||
// Make a copy of current position before to start changing
|
||||
const Position pos(*this, threadID);
|
||||
|
@ -1737,27 +1736,27 @@ void Position::flip() {
|
|||
// Board
|
||||
for (Square s = SQ_A1; s <= SQ_H8; s++)
|
||||
if (!pos.square_is_empty(s))
|
||||
put_piece(Piece(pos.piece_on(s) ^ 8), flip_square(s));
|
||||
put_piece(Piece(pos.piece_on(s) ^ 8), flip(s));
|
||||
|
||||
// Side to move
|
||||
sideToMove = opposite_color(pos.side_to_move());
|
||||
sideToMove = flip(pos.side_to_move());
|
||||
|
||||
// Castling rights
|
||||
if (pos.can_castle(WHITE_OO))
|
||||
set_castle(BLACK_OO, king_square(BLACK), flip_square(pos.castle_rook_square(WHITE_OO)));
|
||||
set_castle(BLACK_OO, king_square(BLACK), flip(pos.castle_rook_square(WHITE_OO)));
|
||||
if (pos.can_castle(WHITE_OOO))
|
||||
set_castle(BLACK_OOO, king_square(BLACK), flip_square(pos.castle_rook_square(WHITE_OOO)));
|
||||
set_castle(BLACK_OOO, king_square(BLACK), flip(pos.castle_rook_square(WHITE_OOO)));
|
||||
if (pos.can_castle(BLACK_OO))
|
||||
set_castle(WHITE_OO, king_square(WHITE), flip_square(pos.castle_rook_square(BLACK_OO)));
|
||||
set_castle(WHITE_OO, king_square(WHITE), flip(pos.castle_rook_square(BLACK_OO)));
|
||||
if (pos.can_castle(BLACK_OOO))
|
||||
set_castle(WHITE_OOO, king_square(WHITE), flip_square(pos.castle_rook_square(BLACK_OOO)));
|
||||
set_castle(WHITE_OOO, king_square(WHITE), flip(pos.castle_rook_square(BLACK_OOO)));
|
||||
|
||||
// En passant square
|
||||
if (pos.st->epSquare != SQ_NONE)
|
||||
st->epSquare = flip_square(pos.st->epSquare);
|
||||
st->epSquare = flip(pos.st->epSquare);
|
||||
|
||||
// Checkers
|
||||
st->checkersBB = attackers_to(king_square(sideToMove)) & pieces(opposite_color(sideToMove));
|
||||
st->checkersBB = attackers_to(king_square(sideToMove)) & pieces(flip(sideToMove));
|
||||
|
||||
// Hash keys
|
||||
st->key = compute_key();
|
||||
|
@ -1817,8 +1816,8 @@ bool Position::is_ok(int* failedStep) const {
|
|||
{
|
||||
int kingCount[2] = {0, 0};
|
||||
for (Square s = SQ_A1; s <= SQ_H8; s++)
|
||||
if (piece_type(piece_on(s)) == KING)
|
||||
kingCount[piece_color(piece_on(s))]++;
|
||||
if (type_of(piece_on(s)) == KING)
|
||||
kingCount[color_of(piece_on(s))]++;
|
||||
|
||||
if (kingCount[0] != 1 || kingCount[1] != 1)
|
||||
return false;
|
||||
|
@ -1829,7 +1828,7 @@ bool Position::is_ok(int* failedStep) const {
|
|||
if (debugKingCapture)
|
||||
{
|
||||
Color us = side_to_move();
|
||||
Color them = opposite_color(us);
|
||||
Color them = flip(us);
|
||||
Square ksq = king_square(them);
|
||||
if (attackers_to(ksq) & pieces(us))
|
||||
return false;
|
||||
|
|
|
@ -204,7 +204,7 @@ public:
|
|||
|
||||
// Position consistency check, for debugging
|
||||
bool is_ok(int* failedStep = NULL) const;
|
||||
void flip();
|
||||
void flip_me();
|
||||
|
||||
// Global initialization
|
||||
static void init();
|
||||
|
@ -380,7 +380,7 @@ inline bool Position::in_check() const {
|
|||
}
|
||||
|
||||
inline bool Position::pawn_is_passed(Color c, Square s) const {
|
||||
return !(pieces(PAWN, opposite_color(c)) & passed_pawn_mask(c, s));
|
||||
return !(pieces(PAWN, flip(c)) & passed_pawn_mask(c, s));
|
||||
}
|
||||
|
||||
inline Key Position::get_key() const {
|
||||
|
|
|
@ -270,7 +270,7 @@ namespace {
|
|||
if (moveIsCheck && pos.see_sign(m) >= 0)
|
||||
result += CheckExtension[PvNode];
|
||||
|
||||
if (piece_type(pos.piece_on(move_from(m))) == PAWN)
|
||||
if (type_of(pos.piece_on(move_from(m))) == PAWN)
|
||||
{
|
||||
Color c = pos.side_to_move();
|
||||
if (relative_rank(c, move_to(m)) == RANK_7)
|
||||
|
@ -286,7 +286,7 @@ namespace {
|
|||
}
|
||||
|
||||
if ( captureOrPromotion
|
||||
&& piece_type(pos.piece_on(move_to(m))) != PAWN
|
||||
&& type_of(pos.piece_on(move_to(m))) != PAWN
|
||||
&& ( pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK)
|
||||
- piece_value_midgame(pos.piece_on(move_to(m))) == VALUE_ZERO)
|
||||
&& !move_is_special(m))
|
||||
|
@ -1493,7 +1493,7 @@ split_point_start: // At split points actual search starts from here
|
|||
|
||||
from = move_from(move);
|
||||
to = move_to(move);
|
||||
them = opposite_color(pos.side_to_move());
|
||||
them = flip(pos.side_to_move());
|
||||
ksq = pos.king_square(them);
|
||||
kingAtt = pos.attacks_from<KING>(ksq);
|
||||
pc = pos.piece_on(from);
|
||||
|
@ -1509,7 +1509,7 @@ split_point_start: // At split points actual search starts from here
|
|||
return true;
|
||||
|
||||
// Rule 2. Queen contact check is very dangerous
|
||||
if ( piece_type(pc) == QUEEN
|
||||
if ( type_of(pc) == QUEEN
|
||||
&& bit_is_set(kingAtt, to))
|
||||
return true;
|
||||
|
||||
|
@ -1644,7 +1644,7 @@ split_point_start: // At split points actual search starts from here
|
|||
// value of the threatening piece, don't prune moves which defend it.
|
||||
if ( pos.move_is_capture(threat)
|
||||
&& ( piece_value_midgame(pos.piece_on(tfrom)) >= piece_value_midgame(pos.piece_on(tto))
|
||||
|| piece_type(pos.piece_on(tfrom)) == KING)
|
||||
|| type_of(pos.piece_on(tfrom)) == KING)
|
||||
&& pos.move_attacks_square(m, tto))
|
||||
return true;
|
||||
|
||||
|
|
24
src/types.h
24
src/types.h
|
@ -370,15 +370,15 @@ inline Piece make_piece(Color c, PieceType pt) {
|
|||
return Piece((c << 3) | pt);
|
||||
}
|
||||
|
||||
inline PieceType piece_type(Piece p) {
|
||||
inline PieceType type_of(Piece p) {
|
||||
return PieceType(p & 7);
|
||||
}
|
||||
|
||||
inline Color piece_color(Piece p) {
|
||||
inline Color color_of(Piece p) {
|
||||
return Color(p >> 3);
|
||||
}
|
||||
|
||||
inline Color opposite_color(Color c) {
|
||||
inline Color flip(Color c) {
|
||||
return Color(c ^ 1);
|
||||
}
|
||||
|
||||
|
@ -395,19 +395,19 @@ inline bool square_is_ok(Square s) {
|
|||
return s >= SQ_A1 && s <= SQ_H8;
|
||||
}
|
||||
|
||||
inline File square_file(Square s) {
|
||||
inline File file_of(Square s) {
|
||||
return File(s & 7);
|
||||
}
|
||||
|
||||
inline Rank square_rank(Square s) {
|
||||
inline Rank rank_of(Square s) {
|
||||
return Rank(s >> 3);
|
||||
}
|
||||
|
||||
inline Square flip_square(Square s) {
|
||||
inline Square flip(Square s) {
|
||||
return Square(s ^ 56);
|
||||
}
|
||||
|
||||
inline Square flop_square(Square s) {
|
||||
inline Square mirror(Square s) {
|
||||
return Square(s ^ 7);
|
||||
}
|
||||
|
||||
|
@ -420,11 +420,11 @@ inline Rank relative_rank(Color c, Rank r) {
|
|||
}
|
||||
|
||||
inline Rank relative_rank(Color c, Square s) {
|
||||
return relative_rank(c, square_rank(s));
|
||||
return relative_rank(c, rank_of(s));
|
||||
}
|
||||
|
||||
inline SquareColor square_color(Square s) {
|
||||
return SquareColor(int(square_rank(s) + s) & 1);
|
||||
return SquareColor(int(rank_of(s) + s) & 1);
|
||||
}
|
||||
|
||||
inline bool opposite_color_squares(Square s1, Square s2) {
|
||||
|
@ -433,11 +433,11 @@ inline bool opposite_color_squares(Square s1, Square s2) {
|
|||
}
|
||||
|
||||
inline int file_distance(Square s1, Square s2) {
|
||||
return abs(square_file(s1) - square_file(s2));
|
||||
return abs(file_of(s1) - file_of(s2));
|
||||
}
|
||||
|
||||
inline int rank_distance(Square s1, Square s2) {
|
||||
return abs(square_rank(s1) - square_rank(s2));
|
||||
return abs(rank_of(s1) - rank_of(s2));
|
||||
}
|
||||
|
||||
inline int square_distance(Square s1, Square s2) {
|
||||
|
@ -453,7 +453,7 @@ inline char rank_to_char(Rank r) {
|
|||
}
|
||||
|
||||
inline const std::string square_to_string(Square s) {
|
||||
char ch[] = { file_to_char(square_file(s)), rank_to_char(square_rank(s)), 0 };
|
||||
char ch[] = { file_to_char(file_of(s)), rank_to_char(rank_of(s)), 0 };
|
||||
return std::string(ch);
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ void uci_loop() {
|
|||
pos.print();
|
||||
|
||||
else if (token == "flip")
|
||||
pos.flip();
|
||||
pos.flip_me();
|
||||
|
||||
else if (token == "eval")
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue