mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Merge branch 'nnue-notemplate2' of https://github.com/dorzechowski/Stockfish into dorzechowski-nnue-notemplate2
This commit is contained in:
commit
e42258db5a
1 changed files with 14 additions and 16 deletions
|
@ -777,7 +777,14 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) {
|
||||||
st->nonPawnMaterial[them] -= PieceValue[MG][captured];
|
st->nonPawnMaterial[them] -= PieceValue[MG][captured];
|
||||||
|
|
||||||
if (use_nnue())
|
if (use_nnue())
|
||||||
|
{
|
||||||
|
dp.dirty_num = 2; // 2 pieces moved
|
||||||
dp1 = piece_id_on(capsq);
|
dp1 = piece_id_on(capsq);
|
||||||
|
dp.pieceId[1] = dp1;
|
||||||
|
dp.old_piece[1] = evalList.piece_with_id(dp1);
|
||||||
|
evalList.put_piece(dp1, capsq, NO_PIECE);
|
||||||
|
dp.new_piece[1] = evalList.piece_with_id(dp1);
|
||||||
|
}
|
||||||
|
|
||||||
// Update board and piece lists
|
// Update board and piece lists
|
||||||
remove_piece(capsq);
|
remove_piece(capsq);
|
||||||
|
@ -794,18 +801,6 @@ void Position::do_move(Move m, StateInfo& newSt, bool givesCheck) {
|
||||||
|
|
||||||
// Reset rule 50 counter
|
// Reset rule 50 counter
|
||||||
st->rule50 = 0;
|
st->rule50 = 0;
|
||||||
|
|
||||||
if (use_nnue())
|
|
||||||
{
|
|
||||||
dp.dirty_num = 2; // 2 pieces moved
|
|
||||||
dp.pieceId[1] = dp1;
|
|
||||||
dp.old_piece[1] = evalList.piece_with_id(dp1);
|
|
||||||
// Do not use EvalList::put_piece() because the piece is removed
|
|
||||||
// from the game, and the corresponding elements of the piece lists
|
|
||||||
// needs to be PS_NONE.
|
|
||||||
evalList.put_piece(dp1, capsq, NO_PIECE);
|
|
||||||
dp.new_piece[1] = evalList.piece_with_id(dp1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update hash key
|
// Update hash key
|
||||||
|
@ -1053,7 +1048,13 @@ void Position::do_null_move(StateInfo& newSt) {
|
||||||
assert(!checkers());
|
assert(!checkers());
|
||||||
assert(&newSt != st);
|
assert(&newSt != st);
|
||||||
|
|
||||||
|
if (use_nnue()) {
|
||||||
std::memcpy(&newSt, st, sizeof(StateInfo));
|
std::memcpy(&newSt, st, sizeof(StateInfo));
|
||||||
|
st->accumulator.computed_score = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
std::memcpy(&newSt, st, offsetof(StateInfo, accumulator));
|
||||||
|
|
||||||
newSt.previous = st;
|
newSt.previous = st;
|
||||||
st = &newSt;
|
st = &newSt;
|
||||||
|
|
||||||
|
@ -1066,9 +1067,6 @@ void Position::do_null_move(StateInfo& newSt) {
|
||||||
st->key ^= Zobrist::side;
|
st->key ^= Zobrist::side;
|
||||||
prefetch(TT.first_entry(st->key));
|
prefetch(TT.first_entry(st->key));
|
||||||
|
|
||||||
if (use_nnue())
|
|
||||||
st->accumulator.computed_score = false;
|
|
||||||
|
|
||||||
++st->rule50;
|
++st->rule50;
|
||||||
st->pliesFromNull = 0;
|
st->pliesFromNull = 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue