The island game as a pure-Kotlin state machine under game/catan/, wired to the upstream GameRules / GameAi contract and fully unit-tested on the JVM. - game/catan/: CatanModel (state, moves, phases), CatanBoard (19-hex geometry, seeded island generation with the 6/8 separation rule, shared vertex/edge graph), CatanRules (setup, production, the seven and the robber, domestic and maritime trade, building, development cards, Longest Road, Largest Army, win detection), CatanAi (a heuristic opponent that reads only public information). - GameRules.isLegalMove: a defaulted structural legality check so a game with a combinatorial move space (Catan's trade offers) is gated the same way as one with an enumerated move list; MatchController uses it. - GameCatalog.CATAN: the catalogue entry, listed but not yet available (descriptor and screen land with the screen task). - Tests: 51 across CatanBoardTest, CatanRulesTest and CatanAiTest — geometry invariants, generation balance, setup, production, the seven/robber, both trade types, development-card timing, Longest Road edge cases, Largest Army, win detection, and AI games played to a result. - docs/RULES-catan.md, in the per-game style, with the rule choices and the known gaps called out. Two real engine bugs found and fixed while getting the suite green: VERTEX_EDGES counted each shared edge once per adjacent hex, so an interior vertex looked like it had six edges (which also double-counted segments in the Longest Road search and duplicated setup moves); and the applyRoll seven-transition was a discarded expression, so a seven never left AWAIT_ROLL. Three test fixtures rolled from the PLAYING phase and two assumed a two-seat rotation; corrected to the phases and seat order the engine actually uses. Verified: ./gradlew :app:testDebugUnitTest --offline — 679 tests, 0 failures. Co-Authored-By: Paperclip <[email protected]>
This commit is contained in:
co-authored by
Paperclip
parent
5c797c8807
commit
3a930f5423
@@ -24,6 +24,7 @@ Naming: the catalogue id, lowercase, e.g. `crazy8s` → `RULES-crazy8s.md`.
|
||||
| Golf | [RULES-golf.md](RULES-golf.md) |
|
||||
| Hearts | — (TODO) |
|
||||
| Kaiser | [RULES-kaiser.md](RULES-kaiser.md) |
|
||||
| Katan (catalogue id `catan`) | [RULES-catan.md](RULES-catan.md) |
|
||||
| Klondike | — (TODO) |
|
||||
| Mastermind | [RULES-mastermind.md](RULES-mastermind.md) |
|
||||
| Morris | [RULES-morris.md](RULES-morris.md) |
|
||||
|
||||
Reference in New Issue
Block a user