mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Retire kingSquare[] array
It is redundant. Use pieceList[c][KING][0] instead. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
44cb792c76
commit
dcb323bf0d
2 changed files with 3 additions and 13 deletions
|
@ -704,7 +704,7 @@ void Position::do_move(Move m, StateInfo& newSt, Bitboard dcCandidates) {
|
|||
struct ReducedStateInfo {
|
||||
Key key, pawnKey, materialKey;
|
||||
int castleRights, rule50;
|
||||
Square kingSquare[2], epSquare;
|
||||
Square epSquare;
|
||||
Value mgValue, egValue;
|
||||
Value npMaterial[2];
|
||||
};
|
||||
|
@ -784,10 +784,6 @@ void Position::do_move(Move m, StateInfo& newSt, Bitboard dcCandidates) {
|
|||
board[to] = board[from];
|
||||
board[from] = EMPTY;
|
||||
|
||||
// If the moving piece was a king, update the king square
|
||||
if (pt == KING)
|
||||
st->kingSquare[us] = to;
|
||||
|
||||
// Update piece lists, note that index[from] is not updated and
|
||||
// becomes stale. This works as long as index[] is accessed just
|
||||
// by known occupied squares.
|
||||
|
@ -1005,9 +1001,6 @@ void Position::do_castle_move(Move m) {
|
|||
board[kto] = king;
|
||||
board[rto] = rook;
|
||||
|
||||
// Update king square
|
||||
st->kingSquare[us] = kto;
|
||||
|
||||
// Update piece lists
|
||||
pieceList[us][KING][index[kfrom]] = kto;
|
||||
pieceList[us][ROOK][index[rfrom]] = rto;
|
||||
|
@ -1519,9 +1512,6 @@ void Position::put_piece(Piece p, Square s) {
|
|||
set_bit(&byTypeBB[0], s); // HACK: byTypeBB[0] contains all occupied squares.
|
||||
|
||||
pieceCount[c][pt]++;
|
||||
|
||||
if (pt == KING)
|
||||
st->kingSquare[c] = s;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ enum Phase {
|
|||
struct StateInfo {
|
||||
Key key, pawnKey, materialKey;
|
||||
int castleRights, rule50;
|
||||
Square kingSquare[2], epSquare;
|
||||
Square epSquare;
|
||||
Value mgValue, egValue;
|
||||
Value npMaterial[2];
|
||||
|
||||
|
@ -408,7 +408,7 @@ inline Square Position::ep_square() const {
|
|||
}
|
||||
|
||||
inline Square Position::king_square(Color c) const {
|
||||
return st->kingSquare[c];
|
||||
return pieceList[c][KING][0];
|
||||
}
|
||||
|
||||
inline bool Position::can_castle_kingside(Color side) const {
|
||||
|
|
Loading…
Add table
Reference in a new issue