fix: flip board coordinates for Black-to-move and prevent coord overflow#20
Merged
Merged
Conversation
Mirror the rank/file labels when the board is rotated 180° (Black to move) so the bottom-left square reads correctly instead of showing a1's labels on an h8 square. Measure the full table (board + coordinate cells) when fitting to screen so the right-hand coordinates no longer overflow. Lower the default target_per_theme from 20 to 17 to reduce puzzles per tranche. https://claude.ai/code/session_01VAUnQCt5CM2TVpRbsQbSBL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
a1's labels while it actually displayedh8. Aflipflag is threaded fromapplyFenToBoard(via adata-flipattribute) throughparseChessintoChessBoard, which reverses the column string (abcdefgh→hgfedcba) and the row string (8…1→1…8) insidegenColorHTML. Applied to bothfront.htmlandback.html.fitChessBoardToScreennow measures the fulltable(board and coordinate cells) instead of only the inner board div, so the right-hand coordinates no longer push the board off-screen when shown.target_per_themefrom 20 to 17 (defaults, docstrings,main()call, andbuild_apkg.build_full), reducing the number of puzzles per ELO tranche.target_per_theme=20references to 17.Test plan
pytest tests/build_apkg_test.py— 31 passedhgfedcba(cols) and1…8top-to-bottom (rows), matching a 180°-rotated boardhttps://claude.ai/code/session_01VAUnQCt5CM2TVpRbsQbSBL
Generated by Claude Code