Skip to content

chess: a table on the lobby, first variant king and pawn against king - #394

Merged
aaylward merged 3 commits into
mainfrom
claude/chess-kpk
Sep 30, 2026
Merged

aaylward merged 3 commits into
mainfrom
claude/chess-kpk

Conversation

@aaylward

@aaylward aaylward commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Adds a chess table to the games lobby, on the backend's new chess envelope (muchq/MoonBase#1620).

  • ChessTable: the board is drawn from the FEN with the viewer's side at the bottom, with file and rank labels.
    • Tap a piece, then one of its moves. The moves come from the hub's legalMoves; the client holds no rules.
    • Promotion opens a piece picker.
    • The clocks count down locally from each view.
    • Resign takes a second tap to confirm. Leaving is offered only before the start, since leaving mid-game forfeits.
    • A waiting table has a clock picker; an ended table shows the result, with Play again and Back.
  • Accessibility: the status line reads out the opponent's move, check, a promotion prompt and the result. Focus moves to the right control after resign, promotion and the game's end.
  • useChessTable holds the table's state and sends its moves. It is wired into useLobby, hubStream, the lobby panel, the command menu, the table overlay, and the stats page's variant labels.
  • Seat counts are per game (seatsOf), since chess seats 2.
  • The table's header and button styles are castle's, as rummy's are.

Checks:

  • vitest: 1260 tests pass; typecheck, lint and build are clean.
  • End to end: I drove two headless browsers through a real game against a locally built games_hub: create, join, start, move, turn handoff, resign, and the result on both sides.

Review panel: four read-only agents covering React correctness, UX/a11y, wire and tests, and altitude. Their fixes are in 3d9ad00. The per-game registry is a follow-up, muchq/MoonBase#1621.

This needs muchq/MoonBase#1620 deployed first. Until then the hub rejects the chess envelope, and nothing else changes.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
muchq d9e8352 Commit Preview URL

Branch Preview URL
Sep 30 2026, 08:17 PM

@cursor

cursor Bot commented Sep 30, 2026

Copy link
Copy Markdown

Blocking

  1. Square colors are inverted. (file + rank) % 2 === 1 paints a1 light (and e4 dark). Standard chess has a1 dark. Flip the light test (=== 0) and pin it — nothing in the suite checks color today.

Nits

  • Off-turn (and ended) squares stay enabled buttons; tap no-ops. Prefer disabled={!myTurn || !connected} (or equivalent) so keyboard users aren’t tabbing 64 inert controls.
  • The clock role="timer" never announces; fine for sighted play, but a polite live update when it drops under ten seconds (or on each view) would match the status-line care elsewhere.
  • status is rendered both in the header (role="status") and again in the ended panel — SR hears the result twice when the game ends.

Fine

Wire matches MoonBase chess.smithy (play/resign/startGame clock, legalMoves, ChessResult endings). Client holds no rules; promotion picker; resign confirm; leave only while waiting; clocks count down from each view; board flips for Black with matching coordinates; seatsOf(chess) === 2; hubStream / lobby / commands / share-link join / stats chess label all wired. CI green. Merge after MoonBase#1620 is deployed — until then the hub rejects the chess envelope and nothing else changes.


Review of #394

Copy link
Copy Markdown
Contributor Author

Addressed in d9e8352:

  • Square colors (blocking): fixed. a1 is now dark. The colors are pinned through data-shade on a1, h8, d1 and e4.
  • Result read twice: the ending panel's copy is aria-hidden, so only the header status announces it. Pinned.
  • Off-turn squares: aria-disabled rather than disabled. Disabling would take away focus from the square just played the moment the turn passes, and would drop the board from the tab order while it's still worth reading. Pinned: inert, and still focusable.
  • Clock announcements: left as is. A live timer announcing its ticks is noise, and the header status already says whose move it is. A one-time "ten seconds left" can come later if it's wanted.

Generated by Claude Code

@aaylward
aaylward merged commit 6ab572c into main Sep 30, 2026
2 checks passed
@aaylward
aaylward deleted the claude/chess-kpk branch September 30, 2026 20:49
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