// Bonus for having the side to move (modified by Joona Kiiski)
const Score TempoValue = make_score(48, 22);
// Bonus for having the side to move (modified by Joona Kiiski)
const Score TempoValue = make_score(48, 22);
void Position::print(Move move) const {
const char* dottedLine = "\n+---+---+---+---+---+---+---+---+\n";
void Position::print(Move move) const {
const char* dottedLine = "\n+---+---+---+---+---+---+---+---+\n";
for (File file = FILE_A; file <= FILE_H; file++)
{
Square sq = make_square(file, rank);
for (File file = FILE_A; file <= FILE_H; file++)
{
Square sq = make_square(file, rank);
Piece piece = piece_on(sq);
if (piece == PIECE_NONE && square_color(sq) == DARK)
piece = PIECE_NONE_DARK_SQ;
Piece piece = piece_on(sq);
if (piece == PIECE_NONE && square_color(sq) == DARK)
piece = PIECE_NONE_DARK_SQ;
cout << c << pieceLetters.from_piece(piece) << c << '|';
}
}
cout << dottedLine << "Fen is: " << to_fen() << "\nKey is: " << st->key << endl;
cout << c << pieceLetters.from_piece(piece) << c << '|';
}
}
cout << dottedLine << "Fen is: " << to_fen() << "\nKey is: " << st->key << endl;
case WB: case BB: return attacks_from<BISHOP>(s);
case WR: case BR: return attacks_from<ROOK>(s);
case WQ: case BQ: return attacks_from<QUEEN>(s);
case WB: case BB: return attacks_from<BISHOP>(s);
case WR: case BR: return attacks_from<ROOK>(s);
case WQ: case BQ: return attacks_from<QUEEN>(s);
case WB: case BB: return bishop_attacks_bb(s, occ);
case WR: case BR: return rook_attacks_bb(s, occ);
case WQ: case BQ: return bishop_attacks_bb(s, occ) | rook_attacks_bb(s, occ);
case WB: case BB: return bishop_attacks_bb(s, occ);
case WR: case BR: return rook_attacks_bb(s, occ);
case WQ: case BQ: return bishop_attacks_bb(s, occ) | rook_attacks_bb(s, occ);
- assert(piece_on(from) == piece_of_color_and_type(us, PAWN));
- assert(piece_on(capsq) == piece_of_color_and_type(them, PAWN));
+ assert(piece_on(from) == make_piece(us, PAWN));
+ assert(piece_on(capsq) == make_piece(them, PAWN));
// If the moving piece is a king, check whether the destination
// square is attacked by the opponent.
// If the moving piece is a king, check whether the destination
// square is attacked by the opponent.
assert(move_is_ok(m));
assert(ci.dcCandidates == discovered_check_candidates(side_to_move()));
assert(color_of_piece_on(move_from(m)) == side_to_move());
assert(move_is_ok(m));
assert(ci.dcCandidates == discovered_check_candidates(side_to_move()));
assert(color_of_piece_on(move_from(m)) == side_to_move());
// Insert promoted piece instead of pawn
clear_bit(&(byTypeBB[PAWN]), to);
set_bit(&(byTypeBB[promotion]), to);
// Insert promoted piece instead of pawn
clear_bit(&(byTypeBB[PAWN]), to);
set_bit(&(byTypeBB[promotion]), to);
assert(to == st->epSquare);
assert(relative_rank(opposite_color(them), to) == RANK_6);
assert(piece_on(to) == PIECE_NONE);
assert(to == st->epSquare);
assert(relative_rank(opposite_color(them), to) == RANK_6);
assert(piece_on(to) == PIECE_NONE);
- assert(piece_on(kfrom) == piece_of_color_and_type(us, KING));
- assert(piece_on(rfrom) == piece_of_color_and_type(us, ROOK));
+ assert(piece_on(kfrom) == make_piece(us, KING));
+ assert(piece_on(rfrom) == make_piece(us, ROOK));
- Piece king = piece_of_color_and_type(us, KING);
- Piece rook = piece_of_color_and_type(us, ROOK);
+ Piece king = make_piece(us, KING);
+ Piece rook = make_piece(us, ROOK);
assert(!pm || relative_rank(us, to) == RANK_8);
assert(!ep || to == st->previous->epSquare);
assert(!ep || relative_rank(us, to) == RANK_6);
assert(!pm || relative_rank(us, to) == RANK_8);
assert(!ep || to == st->previous->epSquare);
assert(!ep || relative_rank(us, to) == RANK_6);
// Replace promoted piece with a pawn
clear_bit(&(byTypeBB[promotion]), to);
// Replace promoted piece with a pawn
clear_bit(&(byTypeBB[promotion]), to);
do_move_bb(&(byTypeBB[pt]), move_bb);
do_move_bb(&(byTypeBB[0]), move_bb); // HACK: byTypeBB[0] == occupied squares
do_move_bb(&(byTypeBB[pt]), move_bb);
do_move_bb(&(byTypeBB[0]), move_bb); // HACK: byTypeBB[0] == occupied squares
set_bit(&(byTypeBB[st->capturedType]), capsq);
set_bit(&(byTypeBB[0]), capsq);
set_bit(&(byTypeBB[st->capturedType]), capsq);
set_bit(&(byTypeBB[0]), capsq);
- assert(piece_on(kto) == piece_of_color_and_type(us, KING));
- assert(piece_on(rto) == piece_of_color_and_type(us, ROOK));
+ assert(piece_on(kto) == make_piece(us, KING));
+ assert(piece_on(rto) == make_piece(us, ROOK));
// Remove pieces from destination squares:
clear_bit(&(byColorBB[us]), kto);
// Remove pieces from destination squares:
clear_bit(&(byColorBB[us]), kto);
- board[rfrom] = piece_of_color_and_type(us, ROOK);
- board[kfrom] = piece_of_color_and_type(us, KING);
+ board[rfrom] = make_piece(us, ROOK);
+ board[kfrom] = make_piece(us, KING);
- if (piece_on(piece_list(c, pt, i)) != piece_of_color_and_type(c, pt))
+ if (piece_on(piece_list(c, pt, i)) != make_piece(c, pt))
if (failedStep) (*failedStep)++;
if (debugCastleSquares) {
for (Color c = WHITE; c <= BLACK; c++) {
if (failedStep) (*failedStep)++;
if (debugCastleSquares) {
for (Color c = WHITE; c <= BLACK; c++) {