{
Square s = pop_1st_bit(&b);
- assert(pos.piece_on(s) == pawn_of_color(us));
+ assert(pos.piece_on(s) == piece_of_color_and_type(us, PAWN));
assert(pos.pawn_is_passed(us, s));
int r = int(relative_rank(us, s) - RANK_2);
void evaluate_trapped_bishop_a7h7(const Position &pos, Square s, Color us,
EvalInfo &ei) {
assert(square_is_ok(s));
- assert(pos.piece_on(s) == bishop_of_color(us));
+ assert(pos.piece_on(s) == piece_of_color_and_type(us, BISHOP));
Square b6 = relative_square(us, (square_file(s) == FILE_A) ? SQ_B6 : SQ_G6);
Square b8 = relative_square(us, (square_file(s) == FILE_A) ? SQ_B8 : SQ_G8);
assert(Chess960);
assert(square_is_ok(s));
- assert(pos.piece_on(s) == bishop_of_color(us));
+ assert(pos.piece_on(s) == piece_of_color_and_type(us, BISHOP));
if (square_file(s) == FILE_A)
{
Square ksq = pos.king_square(opposite_color(us));
MoveStack* mlist_start = mlist;
- assert(pos.piece_on(ksq) == king_of_color(opposite_color(us)));
+ assert(pos.piece_on(ksq) == piece_of_color_and_type(opposite_color(us), KING));
// Pieces moves
mlist = generate_piece_checks<PAWN>(pos, mlist, us, dc, ksq);
Square ksq = pos.king_square(us);
MoveStack* mlist_start = mlist;
- assert(pos.piece_on(ksq) == king_of_color(us));
+ assert(pos.piece_on(ksq) == piece_of_color_and_type(us, KING));
// The bitboard of occupied pieces without our king
Bitboard b_noKing = pos.occupied_squares();
return false;
assert(pos.square_is_empty(to));
- assert(pos.piece_on(to - pawn_push(us)) == pawn_of_color(them));
+ assert(pos.piece_on(to - pawn_push(us)) == piece_of_color_and_type(them, PAWN));
// The move is pseudo-legal, check if it is also legal
return pos.pl_move_is_legal(m, pinned);
assert(from == pos.king_square(us));
assert(to == pos.initial_kr_square(us));
- assert(pos.piece_on(to) == rook_of_color(us));
+ assert(pos.piece_on(to) == piece_of_color_and_type(us, ROOK));
Square g1 = relative_square(us, SQ_G1);
Square f1 = relative_square(us, SQ_F1);
assert(from == pos.king_square(us));
assert(to == pos.initial_qr_square(us));
- assert(pos.piece_on(to) == rook_of_color(us));
+ assert(pos.piece_on(to) == piece_of_color_and_type(us, ROOK));
Square c1 = relative_square(us, SQ_C1);
Square d1 = relative_square(us, SQ_D1);
Color them = opposite_color(us);
Square ksq = pos.king_square(us);
- assert(pos.piece_on(ksq) == king_of_color(us));
+ assert(pos.piece_on(ksq) == piece_of_color_and_type(us, KING));
Square rsq = (Side == KING_SIDE ? pos.initial_kr_square(us) : pos.initial_qr_square(us));
Square s1 = relative_square(us, Side == KING_SIDE ? SQ_G1 : SQ_C1);
Square s;
bool illegal = false;
- assert(pos.piece_on(rsq) == rook_of_color(us));
+ assert(pos.piece_on(rsq) == piece_of_color_and_type(us, ROOK));
// It is a bit complicated to correctly handle Chess960
for (s = Min(ksq, s1); s <= Max(ksq, s1); s++)
File f = square_file(s);
Rank r = square_rank(s);
- assert(pos.piece_on(s) == pawn_of_color(us));
+ assert(pos.piece_on(s) == piece_of_color_and_type(us, PAWN));
// The file containing the pawn is not half open
pi->halfOpenFiles[us] &= ~(1 << f);
Square ksq = king_square(us);
assert(color_of_piece_on(from) == us);
- assert(piece_on(ksq) == king_of_color(us));
+ assert(piece_on(ksq) == piece_of_color_and_type(us, KING));
// En passant captures are a tricky special case. Because they are
// rather uncommon, we do it simply by testing whether the king is attacked
Bitboard b = occupied_squares();
assert(to == ep_square());
- assert(piece_on(from) == pawn_of_color(us));
- assert(piece_on(capsq) == pawn_of_color(them));
+ 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(to) == EMPTY);
clear_bit(&b, from);
Square ksq = king_square(them);
assert(color_of_piece_on(from) == us);
- assert(piece_on(ksq) == king_of_color(them));
+ assert(piece_on(ksq) == piece_of_color_and_type(them, KING));
// Proceed according to the type of the moving piece
switch (type_of_piece_on(from))
Square rfrom = move_to(m); // HACK: See comment at beginning of function
Square kto, rto;
- assert(piece_on(kfrom) == king_of_color(us));
- assert(piece_on(rfrom) == rook_of_color(us));
+ assert(piece_on(kfrom) == piece_of_color_and_type(us, KING));
+ assert(piece_on(rfrom) == piece_of_color_and_type(us, ROOK));
// Find destination squares for king and rook
if (rfrom > kfrom) // O-O
to = move_to(m);
assert(relative_rank(us, to) == RANK_8);
- assert(piece_on(from) == pawn_of_color(us));
+ assert(piece_on(from) == piece_of_color_and_type(us, PAWN));
assert(color_of_piece_on(to) == them || square_is_empty(to));
capture = type_of_piece_on(to);
assert(to == epSquare);
assert(relative_rank(us, to) == RANK_6);
assert(piece_on(to) == EMPTY);
- assert(piece_on(from) == pawn_of_color(us));
- assert(piece_on(capsq) == pawn_of_color(them));
+ assert(piece_on(from) == piece_of_color_and_type(us, PAWN));
+ assert(piece_on(capsq) == piece_of_color_and_type(them, PAWN));
// Remove captured piece
clear_bit(&(byColorBB[them]), capsq);
rto = relative_square(us, SQ_D1);
}
- assert(piece_on(kto) == king_of_color(us));
- assert(piece_on(rto) == rook_of_color(us));
+ assert(piece_on(kto) == piece_of_color_and_type(us, KING));
+ assert(piece_on(rto) == piece_of_color_and_type(us, ROOK));
// Remove pieces from destination squares
clear_bit(&(byColorBB[us]), kto);
assert(to == ep_square());
assert(relative_rank(us, to) == RANK_6);
- assert(piece_on(to) == pawn_of_color(us));
+ assert(piece_on(to) == piece_of_color_and_type(us, PAWN));
assert(piece_on(from) == EMPTY);
assert(piece_on(capsq) == EMPTY);