Katan: no roads past an opponent's settlement, piece limits, stable layout #4

Merged
devadmin merged 1 commits from fix/catan-road-rule-and-ui-stability into dev 2026-10-15 08:03:26 -06:00
Owner

Two problems reported from playtesting.

1. A computer built a road past my settlement

CatanRules.roadConnects accepted any edge touching a crossing where the player had a road, without checking who owned a building on that crossing. So a road could be laid straight past an opponent's settlement (and the AI, which picks from the legal list, did).

Fix: a road may only start from a crossing where the player owns a building, or where one of their roads ends and no opponent's settlement or city stands. Applies to paid roads and to Road Building's free roads. Longest Road already treated opponents' buildings as walls; the placement rule now agrees with it.

Rules review also found: piece limits were not enforced at all. Each player now has 15 roads, 5 settlements and 4 cities (a raised settlement returns to the supply). Reflected in docs/RULES-catan.md.

Tests added in CatanRulesTest: past a settlement, past a city, free roads, own building not blocking, running out of each piece.

2. The board rescaled when it became my turn

The action buttons only existed on the player's turn, so the area below the board changed height and the board (which takes the remaining space) was rescaled. Also the prompt wrapped to 1 or 2 lines and player cards gained a line when someone held an award.

Fix: everything outside the board now has a fixed height. The action bar always shows every button (enabled/disabled, never absent), with a fixed-height primary row; the prompt is pinned to two lines (a refused move replaces it rather than adding to it); player cards always draw every line, never wrap, and use a compact variant in the portrait strip; the dice total is always present. The rule is recorded in docs/UI-catan.md so future changes keep it.

Testing

CI run 35: build, unit tests and lint green. Layout stability is not unit-testable; please check on a device that the board no longer changes size between your turn and the computers'.

Not changed (noted)

The engine only allows playing a development card after rolling; the published rules also allow a Knight before the roll. Left as is.

Co-Authored-By: Claude Sonnet 5.5 [email protected]
Claude-Session: https://claude.ai/code/session_01JdMNbY5hLR7FjtfEE712xG

Two problems reported from playtesting. ## 1. A computer built a road past my settlement `CatanRules.roadConnects` accepted any edge touching a crossing where the player had a road, without checking who owned a building on that crossing. So a road could be laid straight past an opponent's settlement (and the AI, which picks from the legal list, did). **Fix:** a road may only start from a crossing where the player owns a building, or where one of their roads ends *and* no opponent's settlement or city stands. Applies to paid roads and to Road Building's free roads. Longest Road already treated opponents' buildings as walls; the placement rule now agrees with it. **Rules review also found:** piece limits were not enforced at all. Each player now has 15 roads, 5 settlements and 4 cities (a raised settlement returns to the supply). Reflected in `docs/RULES-catan.md`. Tests added in `CatanRulesTest`: past a settlement, past a city, free roads, own building not blocking, running out of each piece. ## 2. The board rescaled when it became my turn The action buttons only existed on the player's turn, so the area below the board changed height and the board (which takes the remaining space) was rescaled. Also the prompt wrapped to 1 or 2 lines and player cards gained a line when someone held an award. **Fix:** everything outside the board now has a fixed height. The action bar always shows every button (enabled/disabled, never absent), with a fixed-height primary row; the prompt is pinned to two lines (a refused move replaces it rather than adding to it); player cards always draw every line, never wrap, and use a compact variant in the portrait strip; the dice total is always present. The rule is recorded in `docs/UI-catan.md` so future changes keep it. ## Testing [CI run 35](https://git.wallacenet.ca/devadmin/ProLibertateGames/actions/runs/35): build, unit tests and lint green. Layout stability is not unit-testable; please check on a device that the board no longer changes size between your turn and the computers'. ## Not changed (noted) The engine only allows playing a development card after rolling; the published rules also allow a Knight before the roll. Left as is. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JdMNbY5hLR7FjtfEE712xG
devadmin added 1 commit 2026-10-15 08:02:48 -06:00
Katan: no roads past an opponent's settlement, piece limits, stable layout
CI / Deploy to Cloudflare Pages (pull_request) Skipped
CI / Build and check (pull_request) Successful in 7m22s
3b0b307997
Rules
- A road may only start from a crossing where the player has a building, or
  where one of their roads ends AND no opponent's settlement or city stands.
  roadConnects ignored opponents' buildings, so a road (the computer's included)
  could be laid straight past a settlement. Also applies to Road Building.
- Enforce the piece supply: 15 roads, 5 settlements, 4 cities. It was
  unlimited.
- Tests: building past a settlement and a city, free roads, own settlement not
  blocking, and running out of each piece.

UI
- The layout rescaled the board whenever it became the player's turn, because
  the action buttons only existed then. Everything outside the board now has a
  fixed height: the action bar always shows every button (disabled, not absent),
  the prompt is pinned to two lines, player cards always draw every line, and
  the dice total is always present. Rule recorded in docs/UI-catan.md.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdMNbY5hLR7FjtfEE712xG
devadmin merged commit ef69704e00 into dev 2026-10-15 08:03:26 -06:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: devadmin/ProLibertateGames#4