Skip to content

fix: flip board coordinates for Black-to-move and prevent coord overflow#20

Merged
SKOHscripts merged 1 commit into
mainfrom
claude/anki-guid-puzzle-id-4pdvG
May 28, 2026
Merged

fix: flip board coordinates for Black-to-move and prevent coord overflow#20
SKOHscripts merged 1 commit into
mainfrom
claude/anki-guid-puzzle-id-4pdvG

Conversation

@SKOHscripts

Copy link
Copy Markdown
Owner

Summary

  • Coordinate flip (Black to move): When the board is rotated 180° because it's Black's turn, the rank/file labels are now mirrored too. Previously the bottom-left square showed a1's labels while it actually displayed h8. A flip flag is threaded from applyFenToBoard (via a data-flip attribute) through parseChess into ChessBoard, which reverses the column string (abcdefghhgfedcba) and the row string (8…11…8) inside genColorHTML. Applied to both front.html and back.html.
  • Coordinate overflow: fitChessBoardToScreen now measures the full table (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.
  • Sampling default: lowered target_per_theme from 20 to 17 (defaults, docstrings, main() call, and build_apkg.build_full), reducing the number of puzzles per ELO tranche.
  • README: updated the two stale target_per_theme=20 references to 17.

Test plan

  • pytest tests/build_apkg_test.py — 31 passed
  • Verified the flip transform produces hgfedcba (cols) and 1…8 top-to-bottom (rows), matching a 180°-rotated board
  • Visual check in Anki: Black-to-move puzzle shows correctly mirrored coordinates
  • Visual check: enabling coordinates on a narrow screen no longer overflows the board to the right

https://claude.ai/code/session_01VAUnQCt5CM2TVpRbsQbSBL


Generated by Claude Code

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
@SKOHscripts SKOHscripts marked this pull request as ready for review May 28, 2026 17:18
@SKOHscripts SKOHscripts merged commit bcb5919 into main May 28, 2026
14 checks passed
@SKOHscripts SKOHscripts deleted the claude/anki-guid-puzzle-id-4pdvG branch May 28, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants