Skip to content

Overhaul all four games: authentic clockwise Ludo boards, cross-game polish, agent docs, and CI quality gates#16

Merged
DoRmAmMu1997 merged 11 commits into
mainfrom
claude/games-overhaul
Jul 18, 2026
Merged

Overhaul all four games: authentic clockwise Ludo boards, cross-game polish, agent docs, and CI quality gates#16
DoRmAmMu1997 merged 11 commits into
mainfrom
claude/games-overhaul

Conversation

@DoRmAmMu1997

Copy link
Copy Markdown
Owner

Summary

One staged overhaul of all four games, in four jobs:

1. Ludo board authenticity + clockwise movement

  • 4P: rebuilt as the classic 15x15 cross from one seat-0 quarter template rotated 90 degrees per seat, fixing the old bug where start squares and home columns disconnected from their yards. Player 1 is blue at the bottom-left; seats continue clockwise, and so do the tokens.
  • 5P/6P: rebuilt from the star shape into compact convex radial boards -- yard triangles between the arms, a central polygon hub with per-seat wedges and the live die, name banners on the outer edge. Seat/colour arrangement matches the reference apps (P1 blue at the bottom).
  • New tests/test_board_geometry.py locks track continuity, clockwise winding, start/yard adjacency, loop-end-to-home handoff, and clockwise seating for every player count.

2. Improvements across all four games

  • Ludo & Monopoly: tokens now hop cell-by-cell / space-by-space like physical pieces (captures and jail teleports still slide directly). Ludo also gained true-to-life setup previews, the bundled window icon, and dead-code removal.
  • Monopoly: named AI valuation constants with rationale, full typing of the AI/UI layer, and the two ~100-line dispatchers split into per-concern handlers.
  • Orbital Orchard: bare physics/merge magic numbers moved into documented settings constants; brand-new engine test suite (18 tests).
  • Solitaire: the ~650-line hint engine now opens with a pipeline map (generate -> filter -> rank -> describe); brand-new Klondike rules suite (12 tests).
  • Docs pass: test docstrings, README refresh, repo-wide Tests section.

3. Agent docs

  • AGENTS.md (~215 lines): architecture pattern, conventions, exact quality-gate commands, Windows gotchas, testing/build/PR rules. CLAUDE.md thin-imports it.

4. Quality gates + CI

  • pyproject.toml (ruff/mypy/bandit), check-only pre-commit config, pinned requirements-dev.txt, and a Quality & Security workflow (Python 3.11 + 3.13): per-game pytest with coverage floors (75/80/90/32), three headless autotests, compileall, ruff, mypy x4, bandit, pip-audit. The entire repo was brought to a clean bill first (~180 auto-fixes + typed Optional-state cleanups such as Monopoly's _require_game()).

Verification

  • All four suites green (28 + 21 + 18 + 12 tests), coverage floors met.
  • LUDO_AUTOTEST / MONOPOLY_AUTOTEST / ORBITAL_ORCHARD_AUTOTEST all exit 0 headless.
  • ruff, mypy (x4 folders), bandit, compileall all clean on the pinned toolchain.
  • Ludo boards rendered headless to PNGs and visually compared against the reference screenshots for all three modes.

Notes for the reviewer

  • Old Ludo saves still load; player colours are re-stamped from the new seat tables on load (cosmetic).
  • The engine walks all 52 shared cells on the 4P board, so the final loop cell sits one diagonal from the home entry (authentic boards walk 51). Kept as-is to preserve saves and engine tests; the hop animation renders it as a natural corner turn.
  • This PR also carries the pre-existing "Overhaul Ludo board visuals" commit (26cb460) that was on the branch before this work.

🤖 Generated with Claude Code

DoRmAmMu1997 and others added 11 commits July 17, 2026 14:59
Replace the misaligned base-track rotation with one seat-0 quarter
template rotated 90 degrees per seat, so every seat's start square,
home column, yard, and finish wedge stay aligned by construction and
tokens travel clockwise like classic Ludo apps.

- settings.py: per-count SEAT_COLORS/SEAT_COLOR_NAMES tables (Player 1
  is always blue and always the bottom seat; seats continue clockwise)
  replacing PLAYER_COLORS/PLAYER_NAMES.
- game.py: seat colours are stamped onto players on construction, so
  restored saves repaint to match the current board palette.
- board_render.py: DisplayLayout now carries seat_colors and cell_size;
  yards reordered to (BL, TL, TR, BR); yard token slots centered;
  centre wedges face their owners; name banners moved outside the
  board edge instead of covering track cells.
- tests: new test_board_geometry.py locks track continuity, clockwise
  winding, start/yard adjacency, loop-end-to-home-entry handoff, home
  lanes marching inward, clockwise seating, and the seat colour table.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replace the star-shaped radial layout (yards at the arm tips) with the
compact reference layout: yard triangles wedged between arms, one cream
convex silhouette, and a central polygon hub.

- Per-count RadialSpec tuning tables; arms sit at pi/2 - pi/n + tau*k/n
  so seat 0's yard points straight down and seats continue clockwise.
- Track per arm: outbound lane away from the hub, tip cell, inbound lane
  back to the hub, giving a clockwise loop whose start cells sit beside
  their owners' yards and whose loop-ends (the arm tips) hand over
  orthogonally to the home columns marching into the hub.
- Yards: colored triangles with white inner triangles, 2x2 token
  clusters, and name banners anchored outside the silhouette.
- Hub: n-gon with one colored wedge per seat facing its home column and
  the live die rendered at the center via the new shared
  visual_theme.draw_die_face helper (also used by the HUD tray).
- Geometry tests now cover 4, 5, and 6 players; the two superseded
  radial shape tests were removed along with dead radial helpers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Tokens now hop cell-by-cell along the track at constant speed instead
  of gliding in a straight line across the board. Captures and yard
  exits stay as single direct slides, matching how players physically
  move tokens. Speed lives in settings.TOKEN_HOP_SPEED.
- The setup screen's abstract polygon previews are replaced with cached
  true-to-life thumbnails rendered via the new BoardRenderer.draw_static,
  with the selected player count highlighted.
- The window icon now loads the bundled ludo_icon.ico (with the drawn
  fallback kept) and the PyInstaller spec bundles the file.
- Removed dead code: the pre-overhaul sidebar drawers (_draw_score_panel,
  _draw_action_panel) and their now-orphaned ui helpers (draw_dice,
  _pip_offsets, draw_panel).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…split

- Tokens now hop space-by-space after a dice roll (constant speed via
  settings.TOKEN_HOP_SPEED); jumps that are not a normal forward roll,
  such as Go To Jail, still slide directly. The existing AI pause while
  animations play is preserved.
- ai.py: the bare valuation multipliers (2.35/1.32/0.28/1.12/0.95/0.08)
  are now named module constants with rationale comments, and every
  function is typed against MonopolyGame/Player via TYPE_CHECKING.
- ui.Button and the main.py click/typing handlers gained type hints;
  _atomic_write's path parameter is now typed as Path.
- The two long dispatchers were split behaviour-preserving:
  _on_button into setup/turn/asset/trade handlers with disjoint key
  families, and _playing_buttons into one small builder per dialog.
- requirements.txt pins pygame-ce>=2.5.2 to match the other games.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- The bare magic numbers moved into documented settings.py constants:
  STRESS_PREVIEW_SHARE/STRESS_TIMER_SHARE (HUD stress phases),
  POSITION_CORRECTION_SOFTNESS (overlap solver), and
  MERGE_VELOCITY_DAMP (merged-body velocity).
- New tests/ directory (the game previously had none): merge detection
  rules (tier matching, contact range, arming delay, max tier, one merge
  per body per frame, mass-weighted spawn, damped velocity), container
  physics guarantees (clamping, wall reflection, spawn span, trajectory
  preview bounds, symmetric separation), and data-table sanity for the
  tier ladder, spawn weights, and stress shares. All engine-only and
  headless.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- The ~650-line hint cluster in solitaire.py now opens with a pipeline
  map (generate -> filter -> rank -> describe), documents the
  wrapper-vs-_on_board naming convention for simulated boards, and warns
  that over-aggressive filters cause false loss verdicts. Stage banners
  mark the filter, ranking, and description sections. No behaviour
  change.
- New tests/test_klondike_rules.py (the game previously had none):
  deal shape, full-deck integrity, draw/recycle cycle, tableau and
  foundation legality, scoring for foundation plays and reveals,
  snapshot/restore round trip, win detection, and three hint-engine
  checks (reveal-first ranking, hint-to-selection legality, and the
  empty-king-shuffle filter). KlondikeGame never touches Tk, so the
  suite runs headless.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Monopoly's four terse test modules now carry the same docstring style
  as the rest of the repo (class summaries plus one-line test intents).
- The Ludo READMEs describe the new boards accurately: classic square
  cross for 4P, compact radial boards for 5P/6P, clockwise movement,
  Player 1 blue at the bottom, and the geometry test suite.
- Orbital Orchard and Solitaire READMEs document their new tests/
  folders and how to run them headless.
- The root README gains a Tests section covering all four suites, the
  SDL dummy driver, and the three autotest modes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Tooling (mirroring the house style of the sibling repos):
- pyproject.toml: ruff (line-length 120, py311, E/W/F/I/B/UP/C4/SIM/RUF,
  per-file ignores for the tests' sys.path shim and the two Monopoly
  data-table modules), shared mypy flags (check_untyped_defs,
  no_implicit_optional, warn_redundant_casts, warn_unused_ignores), and
  bandit with documented B101/B311/B110 skips. The four game folders
  share module names, so mypy runs once per folder.
- .pre-commit-config.yaml: check-only ruff plus merge-conflict/yaml/
  large-file/debug-statement hooks.
- requirements-dev.txt: exact-pinned ruff/mypy/bandit/pytest/pytest-cov/
  pip-audit/pre-commit toolchain.

Code changes to reach a clean bill:
- ~180 auto-fixes (pep585/604 annotations, import order, pyupgrade) plus
  hand fixes for long lines, collapsible branches, contextlib.suppress,
  zip strict=True, and one unused variable.
- Ludo: TokenState now declares _finished_steps as a real field instead
  of an injected attribute; LudoGame accepts a Sequence of seat specs;
  color helpers return explicit RGB 3-tuples; roll handling narrows the
  die value; UI smoke tests import helpers directly.
- Monopoly: an explicit _require_game() invariant helper replaces
  Optional derefs across the app layer; auction/trade/pending-purchase
  states are narrowed where dialogs guarantee them.
- Orbital Orchard: merge candidates are typed against CelestialBody;
  nebula loop variables no longer shadow a differently-shaped tuple.
- Solitaire: annotations for the hint cache and tkinter label style.

All four test suites, the three headless autotests, ruff, mypy (x4),
bandit, and compileall pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
GitHub Actions gate on every PR and push to main, Python 3.11 + 3.13:
pre-commit config validation; the four test suites run from inside each
game folder with per-game engine coverage floors (Ludo 75, Monopoly 80,
Orbital Orchard 90, Solitaire 32 -- each ~5 points under the measured
value at introduction); the three headless pygame autotests; compileall;
ruff; mypy once per game folder (the folders share flat module names);
bandit; and pip-audit over the pinned dev toolchain and game runtime
deps. SDL dummy drivers keep everything headless.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
AGENTS.md is the single source of truth for any coding agent: what the
four games are, the mandatory workflow skills, the repository map, the
UI-free-engine + thin-shell architecture pattern, coding conventions
(self-contained game folders, flat imports, settings-owned tuning knobs,
docstring style, %APPDATA% persistence, narrowing asserts, seeded
randomness), the exact quality-gate commands CI runs, Windows/PowerShell
gotchas, testing conventions, PyInstaller builds, and git/PR rules.
CLAUDE.md simply @-imports it so the two can never drift.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@DoRmAmMu1997
DoRmAmMu1997 merged commit 26ef478 into main Jul 18, 2026
2 checks passed
@DoRmAmMu1997
DoRmAmMu1997 deleted the claude/games-overhaul branch July 18, 2026 10:28
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.

1 participant