Skip to content

Document spell potion options in variants.ini#15

Closed
Belzedar94 wants to merge 1 commit intomasterfrom
codex/implement-spell-chess-functionality
Closed

Document spell potion options in variants.ini#15
Belzedar94 wants to merge 1 commit intomasterfrom
codex/implement-spell-chess-functionality

Conversation

@Belzedar94
Copy link
Copy Markdown
Owner

Summary

  • document the freezePotion and jumpPotion configuration keys alongside other gating-related options in variants.ini

Testing

  • cd src && make -j2 ARCH=x86-64 build
  • cd src && ./stockfish check ../src/variants.ini

https://chatgpt.com/codex/tasks/task_e_68ccefff4f3083228b0a446a83e10926

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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".

Comment on lines 1955 to +1993
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);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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 👍 / 👎.

@Belzedar94 Belzedar94 closed this Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant