// Note that differently from normal case here backupSt is actually used as
// a backup storage not as a new state to be used.
backupSt.key = st->key;
+ backupSt.rule50 = st->rule50;
backupSt.epSquare = st->epSquare;
backupSt.mgValue = st->mgValue;
backupSt.egValue = st->egValue;
sideToMove = opposite_color(sideToMove);
st->epSquare = SQ_NONE;
- st->rule50++;
+ st->rule50 = 0;
gamePly++;
st->mgValue += (sideToMove == WHITE)? TempoValueMidgame : -TempoValueMidgame;
// Restore information from the our backup StateInfo object
StateInfo* backupSt = st->previous;
st->key = backupSt->key;
+ st->rule50 = backupSt->rule50;
st->epSquare = backupSt->epSquare;
st->mgValue = backupSt->mgValue;
st->egValue = backupSt->egValue;
// Update the necessary information
sideToMove = opposite_color(sideToMove);
- st->rule50--;
gamePly--;
}