Rename Position::list

Use Position::square and Position::squares instead.

This allow us to remove king_square(), simplify
endgames and to have more naming uniformity.

Moreover, this is a prerequisite step in case
in the future we decide to retire piece lists
altoghter and use pop_lsb() to loop across
pieces and serialize the moves. In this way
we just need to change definition of Position::square
to something like:

template<PieceType Pt> inline
Square Position::square(Color c) const {
  return lsb(byColorBB[c]);
}

No functional change.
This commit is contained in:
Marco Costalba
2015-08-04 09:00:52 +02:00
parent 68d61b80c6
commit e6310b3469
6 changed files with 109 additions and 109 deletions

View File

@@ -34,7 +34,7 @@ namespace {
// After castling, the rook and king final positions are the same in Chess960
// as they would be in standard chess.
Square kfrom = pos.king_square(us);
Square kfrom = pos.square<KING>(us);
Square rfrom = pos.castling_rook_square(Cr);
Square kto = relative_square(us, KingSide ? SQ_G1 : SQ_C1);
Bitboard enemies = pos.pieces(~us);
@@ -225,7 +225,7 @@ namespace {
assert(Pt != KING && Pt != PAWN);
const Square* pl = pos.list<Pt>(us);
const Square* pl = pos.squares<Pt>(us);
for (Square from = *pl; from != SQ_NONE; from = *++pl)
{
@@ -266,7 +266,7 @@ namespace {
if (Type != QUIET_CHECKS && Type != EVASIONS)
{
Square ksq = pos.king_square(Us);
Square ksq = pos.square<KING>(Us);
Bitboard b = pos.attacks_from<KING>(ksq) & target;
while (b)
*moveList++ = make_move(ksq, pop_lsb(&b));
@@ -364,7 +364,7 @@ ExtMove* generate<EVASIONS>(const Position& pos, ExtMove* moveList) {
assert(pos.checkers());
Color us = pos.side_to_move();
Square ksq = pos.king_square(us);
Square ksq = pos.square<KING>(us);
Bitboard sliderAttacks = 0;
Bitboard sliders = pos.checkers() & ~pos.pieces(KNIGHT, PAWN);
@@ -400,7 +400,7 @@ template<>
ExtMove* generate<LEGAL>(const Position& pos, ExtMove* moveList) {
Bitboard pinned = pos.pinned_pieces(pos.side_to_move());
Square ksq = pos.king_square(pos.side_to_move());
Square ksq = pos.square<KING>(pos.side_to_move());
ExtMove* cur = moveList;
moveList = pos.checkers() ? generate<EVASIONS >(pos, moveList)