Skip to content

Boards fill the screen: Bowling, Tower Defence, Mancala, Backgammon (#359) - #366

Merged
margani merged 1 commit into
mainfrom
issue/359-fit-last
Oct 19, 2026
Merged

margani merged 1 commit into
mainfrom
issue/359-fit-last

Conversation

@margani

@margani margani commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Closes #359 (part 6, the last: Bowling, Tower Defence, Mancala, Backgammon)

What changed

  • Slots. These were the last four games with a fixed cap or a guess at the window's height. Each now uses a .ch-fit slot shaped like its own board:
    • Bowling's lane: 1 : 1.35
    • Tower Defence's map: 10 : 15
    • Mancala's board: WU : HU, set from JS
    • Backgammon: 0.64
  • Side layout. Bowling, Tower Defence and Backgammon put their rows beside the board on a wide screen. Mancala's board is itself wide, so it keeps its rows above and below and only drops its 720px cap.
  • Redraw. Each game redraws on a ResizeObserver on its slot. Bowling's swipe is still read against the view it last drew (Add Bowling (بولینگ): ten frames, swipe to bowl (#313) #322).
  • Mancala switches its player rows to classList, like the other games.

Canvas size at 1280×800, measured on main and on this branch:

main new
Bowling 312×421 529×714
Tower Defence 320×480 470×705
Mancala 720×264 1256×461
Backgammon 364×552 458×715

Proof

  • The new checks, run against main's code:
    ✗ bowling: the board sits in a .ch-fit slot      (and tower-defence, mancala, backgammon)
    ✗ mancala: layout rows keep their classes (classList, not className)
    ✗ bowling: the lane is sized from its slot, not 460px and a guess at the window
    ✗ backgammon: no 560px cap on the board
    ✗ 7 خطا از 4110 بررسی
    
    On this branch: همه‌ی 4110 بررسی سبز. MIN_CHECKS is now 4108. tools/browser-check.sh loaded 35 of 35 pages.
  • A real throw. I made the same straight swipe up the middle of the lane at 1280×800 (lane 529×714) and at 390×844 (lane 365×492). Both knocked down 7 pins, with no page errors, so the swipe maps the same way at both sizes.
  • Visual check: the four games at 390×844, 600×960, 844×390, 1280×800 and 1920×1080. None of them clips or scrolls at any of those sizes.

After this part, across #361–#366: every game's board or cards grow with the screen. Only three games still clip a little in phone landscape, exactly as on main: Minesweeper 19px, Battleship 77px, Mahjong 30px. The card games scroll there, as before.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VoRrYWfb9CHLaEtJPXc4HH

Before, 1280x800

After, 1280x800

…359)

The last four with a fixed cap or a window-height guess. Each now uses a
.ch-fit slot of its own shape (lane 1:1.35, map 10:15, board WU:HU, backgammon
0.64), and Bowling, Tower Defence and Backgammon put their rows beside the
board on a wide screen. Mancala's board is wide, so it keeps its rows above
and below and only drops its 720px cap. Each redraws on a ResizeObserver on
its slot. At 1280x800: Bowling 312x421 -> 529x714, Tower Defence 320x480 ->
470x705, Mancala 720x264 -> 1256x461, Backgammon 364x552 -> 458x715.

Mancala's player rows switch to classList like the other games'.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01VoRrYWfb9CHLaEtJPXc4HH
@margani

margani commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Diff review

  • Tower Defence and Backgammon put ch-fit directly on their existing canvas box, rather than wrapping it in a new one: their resize() already read that box's clientWidth and clientHeight. Each box's old flex: 1; width: 100% was removed, because game styles come later in the cascade and would override the slot's landscape width.
  • Mancala sets --fit-ar from WU / HU right after those constants are defined, which is before the first layout().
  • Tower Defence still sets ctx.main.className = 'ch-gamemain'. That's harmless, because the core's container rule is keyed on that class.
  • Bowling: view() now reads the lane box's height instead of innerHeight - top - 70. shown is still set only in draw(), and draw() runs on the ResizeObserver, so a swipe is never read against a view that wasn't drawn.

@margani
margani merged commit e8aae9b into main Oct 19, 2026
3 checks passed
@margani
margani deleted the issue/359-fit-last branch October 19, 2026 21:20
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.

Games use only part of larger screens (7-inch phones, tablets, laptops)

1 participant