Add support for very large boards and guard Omega variant#13
Add support for very large boards and guard Omega variant#13Belzedar94 wants to merge 1 commit intomasterfrom
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".
| for (Square s = SQ_A1; s <= SQ_MAX; ++s) | ||
| SquareBB[s] = make_bitboard(s); | ||
|
|
||
| #if defined(VERY_LARGE_BOARDS) | ||
| std::array<Bitboard, FILE_NB> fileMask{}; | ||
| std::array<Bitboard, RANK_NB> rankMask{}; | ||
| AllSquares = Bitboard(0); | ||
| DarkSquares = Bitboard(0); | ||
|
|
||
| for (File f = FILE_A; f <= FILE_MAX; ++f) | ||
| for (Rank r = RANK_1; r <= RANK_MAX; ++r) | ||
| { | ||
| Square sq = make_square(f, r); | ||
| Bitboard bb = SquareBB[sq]; | ||
| fileMask[f] |= bb; | ||
| rankMask[r] |= bb; | ||
| AllSquares |= bb; | ||
| if (((int(f) ^ int(r)) & 1) == 1) | ||
| DarkSquares |= bb; | ||
| } | ||
|
|
||
| std::array<Bitboard*, FILE_NB> fileGlobals = { &FileABB, &FileBBB, &FileCBB, &FileDBB, | ||
| &FileEBB, &FileFBB, &FileGBB, &FileHBB, | ||
| &FileIBB, &FileJBB, &FileKBB, &FileLBB, | ||
| &FileMBB, &FileNBB, &FileOBB, &FilePBB }; | ||
| for (int f = 0; f < FILE_NB; ++f) | ||
| *fileGlobals[f] = fileMask[f]; | ||
|
|
||
| std::array<Bitboard*, RANK_NB> rankGlobals = { &Rank1BB, &Rank2BB, &Rank3BB, &Rank4BB, | ||
| &Rank5BB, &Rank6BB, &Rank7BB, &Rank8BB, | ||
| &Rank9BB, &Rank10BB, &Rank11BB, &Rank12BB, | ||
| &Rank13BB, &Rank14BB, &Rank15BB, &Rank16BB }; | ||
| for (int r = 0; r < RANK_NB; ++r) | ||
| *rankGlobals[r] = rankMask[r]; | ||
|
|
||
| int halfFiles = FILE_NB / 2; | ||
| QueenSide = Bitboard(0); | ||
| KingSide = Bitboard(0); | ||
| for (int f = 0; f < halfFiles; ++f) | ||
| QueenSide |= fileMask[f]; | ||
| for (int f = halfFiles; f < FILE_NB; ++f) | ||
| KingSide |= fileMask[f]; |
There was a problem hiding this comment.
[P1] Initialize bitboard constants before constructing variants
The new VERY_LARGE_BOARDS implementation moves AllSquares, RankNBB, FileNBB, KingFlank, etc. from compile‑time constants to globals that are populated inside Bitboards::init() (this block). Existing startup paths call variants.init() before Bitboards::init() (e.g. in main.cpp and in the Python wrapper), and Variant’s default regions are initialized using those globals. With the values still zero when variants.init() runs, the variants end up with empty masks and the pyffish build segfaults when it accesses those regions. Either move Bitboards::init() ahead of variants.init() or provide constexpr defaults so the variant data is valid during construction.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68cc5e69d3348322beb185dbec93be00