{
m = cur->move;
cur->score = piece_value_midgame(pos.piece_on(move_to(m)))
- - pos.type_of_piece_on(move_from(m));
+ - type_of_piece(pos.piece_on(move_from(m)));
if (move_is_promotion(m))
cur->score += QueenValueMidgame;
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)))
- - pos.type_of_piece_on(move_from(m)) + History::MaxValue;
+ - type_of_piece(pos.piece_on(move_from(m))) + History::MaxValue;
else
cur->score = H.value(pos.piece_on(move_from(m)), move_to(m));
}
// 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 (type_of_piece_on(from) == KING)
+ if (type_of_piece(piece_on(from)) == KING)
return move_is_castle(m) || !(attackers_to(move_to(m)) & pieces_of_color(opposite_color(us)));
// A non-king move is legal if and only if it is not pinned or it
{
// 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 (type_of_piece_on(from) == KING)
+ if (type_of_piece(piece_on(from)) == KING)
{
Bitboard b = occupied_squares();
clear_bit(&b, from);
Square from = move_from(m);
Square to = move_to(m);
- PieceType pt = type_of_piece_on(from);
+ PieceType pt = type_of_piece(piece_on(from));
// Direct check ?
if (bit_is_set(ci.checkSq[pt], to))
Piece piece = piece_on(from);
PieceType pt = type_of_piece(piece);
- PieceType capture = ep ? PAWN : type_of_piece_on(to);
+ PieceType capture = ep ? PAWN : type_of_piece(piece_on(to));
assert(color_of_piece_on(from) == us);
assert(color_of_piece_on(to) == them || square_is_empty(to));
bool ep = move_is_ep(m);
bool pm = move_is_promotion(m);
- PieceType pt = type_of_piece_on(to);
+ PieceType pt = type_of_piece(piece_on(to));
assert(square_is_empty(from));
assert(color_of_piece_on(to) == us);
from = move_from(m);
to = move_to(m);
- capturedType = type_of_piece_on(to);
+ capturedType = type_of_piece(piece_on(to));
occupied = occupied_squares();
// Handle en passant moves
- if (st->epSquare == to && type_of_piece_on(from) == PAWN)
+ if (st->epSquare == to && type_of_piece(piece_on(from)) == PAWN)
{
Square capQq = (side_to_move() == WHITE ? to - DELTA_N : to - DELTA_S);
assert(capturedType == PIECE_TYPE_NONE);
- assert(type_of_piece_on(capQq) == PAWN);
+ assert(type_of_piece(piece_on(capQq)) == PAWN);
// Remove the captured pawn
clear_bit(&occupied, capQq);
// 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 = type_of_piece_on(from);
+ capturedType = type_of_piece(piece_on(from));
do {
// Locate the least valuable attacker for the side to move. The loop
for (Square s = SQ_A1; s <= SQ_H8; s++)
if (square_is_occupied(s))
- result ^= zobrist[color_of_piece_on(s)][type_of_piece_on(s)][s];
+ result ^= zobrist[color_of_piece_on(s)][type_of_piece(piece_on(s))][s];
if (ep_square() != SQ_NONE)
result ^= zobEp[ep_square()];
{
int kingCount[2] = {0, 0};
for (Square s = SQ_A1; s <= SQ_H8; s++)
- if (type_of_piece_on(s) == KING)
+ if (type_of_piece(piece_on(s)) == KING)
kingCount[color_of_piece_on(s)]++;
if (kingCount[0] != 1 || kingCount[1] != 1)
// The piece on a given square
Piece piece_on(Square s) const;
- PieceType type_of_piece_on(Square s) const;
Color color_of_piece_on(Square s) const;
bool square_is_empty(Square s) const;
bool square_is_occupied(Square s) const;
return color_of_piece(piece_on(s));
}
-inline PieceType Position::type_of_piece_on(Square s) const {
- return type_of_piece(piece_on(s));
-}
-
inline bool Position::square_is_empty(Square s) const {
return piece_on(s) == PIECE_NONE;
}
if (moveIsCheck && pos.see_sign(m) >= 0)
result += CheckExtension[PvNode];
- if (pos.type_of_piece_on(move_from(m)) == PAWN)
+ if (type_of_piece(pos.piece_on(move_from(m))) == PAWN)
{
Color c = pos.side_to_move();
if (relative_rank(c, move_to(m)) == RANK_7)
}
if ( captureOrPromotion
- && pos.type_of_piece_on(move_to(m)) != PAWN
+ && type_of_piece(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))
// 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))
- || pos.type_of_piece_on(tfrom) == KING)
+ || type_of_piece(pos.piece_on(tfrom)) == KING)
&& pos.move_attacks_square(m, tto))
return true;