Document spell potion options in variants.ini#15
Conversation
There was a problem hiding this comment.
Codex Review: Here are some suggestions.
Reply with @codex fix comments to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
| if (is_gating(m)) | ||
| { | ||
| Square gate = gating_square(m); | ||
| Piece gating_piece = make_piece(us, gating_type(m)); | ||
| PieceType gatingType = gating_type(m); | ||
| Piece gating_piece = make_piece(us, gatingType); | ||
|
|
||
| if (Eval::useNNUE) | ||
| if ( spell_chess() | ||
| && (gatingType == freeze_potion_type() || gatingType == jump_potion_type())) | ||
| { | ||
| // Add gating piece | ||
| dp.piece[dp.dirty_num] = gating_piece; | ||
| dp.handPiece[dp.dirty_num] = gating_piece; | ||
| dp.handCount[dp.dirty_num] = pieceCountInHand[us][gating_type(m)]; | ||
| dp.from[dp.dirty_num] = SQ_NONE; | ||
| dp.to[dp.dirty_num] = gate; | ||
| dp.dirty_num++; | ||
| int before = pieceCountInHand[us][gatingType]; | ||
|
|
||
| if (Eval::useNNUE && nnue_use_pockets()) | ||
| { | ||
| dp.piece[dp.dirty_num] = NO_PIECE; | ||
| dp.handPiece[dp.dirty_num] = gating_piece; | ||
| dp.handCount[dp.dirty_num] = before; | ||
| dp.from[dp.dirty_num] = SQ_NONE; | ||
| dp.to[dp.dirty_num] = SQ_NONE; | ||
| dp.dirty_num++; | ||
| } | ||
|
|
||
| if (!variant()->freeDrops && before > 0) | ||
| k ^= Zobrist::inHand[gating_piece][before - 1] | ||
| ^ Zobrist::inHand[gating_piece][before]; | ||
|
|
||
| remove_from_hand(gating_piece); | ||
|
|
||
| if (gatingType == freeze_potion_type()) | ||
| { | ||
| Bitboard zone = (attacks_bb<KING>(gate) | square_bb(gate)) & board_bb(); | ||
| st->freezeZone[them] = zone; | ||
| st->freezeCD[us] = SpellCooldownTurns; | ||
| st->jumpIgnore[us] = 0; | ||
| } | ||
| else | ||
| { | ||
| st->jumpCD[us] = SpellCooldownTurns; | ||
| st->jumpIgnore[us] = square_bb(gate); | ||
| } |
There was a problem hiding this comment.
[P1] Hash ignores spell cooldown and freeze state
The new spell‑chess logic stores per‑color freeze zones and jump cooldowns in StateInfo (freezeZone, jumpCD, jumpIgnore), and move generation consults these values to forbid moves or spells. However do_move() only updates the Zobrist key for pocket changes; the assignments at freezeZone[them], freezeCD[us] and jumpCD[us] are not hashed. Two positions that have the same board and pockets but differ in whether a freeze area is active or how many turns remain before a spell can be cast will produce the same hash, so the transposition table and repetition detection will treat them as identical while their legal move sets differ. This can yield wrong TT hits and incorrect threefold detection whenever spells are used. Consider adding Zobrist components for these new state variables or encoding them in the FEN/key.
Useful? React with 👍 / 👎.
Summary
variants.iniTesting
cd src && make -j2 ARCH=x86-64 buildcd src && ./stockfish check ../src/variants.inihttps://chatgpt.com/codex/tasks/task_e_68ccefff4f3083228b0a446a83e10926