X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fposition.cpp;h=25532a7dd4831e4e0c80d3230cff014070659dd3;hb=dd1855eb2f3058b382e0c66b4d5e4a7bd7fc5c4d;hp=d145ddfa0def3ae65959b0593667a6ad2e34e466;hpb=7e95495b35ef84a87fa6be34639a5f96e67972b0;p=stockfish diff --git a/src/position.cpp b/src/position.cpp index d145ddfa..25532a7d 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -85,17 +85,17 @@ void init() { side = rk.rand(); exclusion = rk.rand(); - for (PieceType pt = PAWN; pt <= KING; pt++) + for (Piece pc = W_PAWN; pc <= W_KING; pc++) { - PieceValue[MG][make_piece(BLACK, pt)] = PieceValue[MG][pt]; - PieceValue[EG][make_piece(BLACK, pt)] = PieceValue[EG][pt]; + PieceValue[MG][~pc] = PieceValue[MG][pc]; + PieceValue[EG][~pc] = PieceValue[EG][pc]; - Score v = make_score(PieceValue[MG][pt], PieceValue[EG][pt]); + Score v = make_score(PieceValue[MG][pc], PieceValue[EG][pc]); for (Square s = SQ_A1; s <= SQ_H8; s++) { - pieceSquareTable[make_piece(WHITE, pt)][ s] = (v + PSQT[pt][s]); - pieceSquareTable[make_piece(BLACK, pt)][~s] = -(v + PSQT[pt][s]); + pieceSquareTable[ pc][ s] = (v + PSQT[pc][s]); + pieceSquareTable[~pc][~s] = -(v + PSQT[pc][s]); } } } @@ -747,17 +747,17 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI Color them = ~us; Square from = from_sq(m); Square to = to_sq(m); - Piece piece = piece_on(from); - PieceType pt = type_of(piece); + Piece pc = piece_on(from); + PieceType pt = type_of(pc); PieceType capture = type_of(m) == ENPASSANT ? PAWN : type_of(piece_on(to)); - assert(color_of(piece) == us); + assert(color_of(pc) == us); assert(piece_on(to) == NO_PIECE || color_of(piece_on(to)) == them || type_of(m) == CASTLE); assert(capture != KING); if (type_of(m) == CASTLE) { - assert(piece == make_piece(us, KING)); + assert(pc == make_piece(us, KING)); bool kingSide = to > from; Square rfrom = to; // Castle is encoded as "king captures friendly rook" @@ -857,7 +857,7 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI byColorBB[us] ^= from_to_bb; board[from] = NO_PIECE; - board[to] = piece; + board[to] = pc; // Update piece lists, index[from] is not updated and becomes stale. This // works as long as index[] is accessed just by known occupied squares. @@ -920,7 +920,7 @@ void Position::do_move(Move m, StateInfo& newSt, const CheckInfo& ci, bool moveI } // Update incremental scores - st->psqScore += pieceSquareTable[piece][to] - pieceSquareTable[piece][from]; + st->psqScore += pieceSquareTable[pc][to] - pieceSquareTable[pc][from]; // Set capture piece st->capturedType = capture;