Merge feature/catan-engine into dev (Katan rules engine + AI, WALA-119) #2

Merged
devadmin merged 3 commits from catan-into-dev into dev 2026-10-14 15:57:04 -06:00
2 changed files with 31 additions and 9 deletions
Showing only changes of commit fb59372802 - Show all commits
@@ -94,6 +94,13 @@ object GameCatalog {
const val MORRIS = "morris" const val MORRIS = "morris"
const val PIRATES = "pirates" const val PIRATES = "pirates"
/**
* The island game the collection is named for. Listed under Board Games
* and marked *Coming soon*; the engine and its screen land with the game
* task, and `available` flips on once two-device play is verified.
*/
const val CATAN = "catan"
val all: List<GameDescriptor> = listOf( val all: List<GameDescriptor> = listOf(
GameDescriptor( GameDescriptor(
id = EUCHRE, id = EUCHRE,
@@ -333,6 +340,19 @@ object GameCatalog {
"because your score multiplies them.", "because your score multiplies them.",
available = true, available = true,
), ),
GameDescriptor(
id = CATAN,
title = "Katan",
menus = setOf(GameMenu.BOARD),
minPlayers = 3,
maxPlayers = 4,
teamBased = false,
blurb = "Trade, build, and settle the island.",
// Listed, not playable: the engine and screen land with the Katan
// game task. Dev builds show the entry as *Coming soon*; a
// production build lists only what can actually be played.
available = false,
),
) )
fun byId(id: String): GameDescriptor? = all.firstOrNull { it.id == id } fun byId(id: String): GameDescriptor? = all.firstOrNull { it.id == id }
@@ -106,17 +106,19 @@ class CatalogTest {
} }
@Test @Test
fun `every game in the catalogue can be played`() { fun `every reference game in the catalogue can be played`() {
// There is nothing left marked "coming soon". The machinery that hides // Every game the app ships is playable. The one exception is Katan,
// unfinished games from a production build is still there and still // listed so the slot exists and marked *Coming soon* until its engine
// tested above — it simply has nothing to hide at the moment, and this // and screen land — `available = false` is what keeps an unfinished
// is what will fail the day something is added to the list before its // game out of a production build while leaving it visible on a dev one.
// engine is written.
assertTrue(GameCatalog.all.all { it.available })
assertEquals( assertEquals(
GameCatalog.inMenu(GameMenu.BOARD, includeComingSoon = false), listOf(GameCatalog.CATAN),
GameCatalog.inMenu(GameMenu.BOARD, includeComingSoon = true), GameCatalog.all.filterNot { it.available }.map { it.id },
) )
// It is also the only difference the two channels see in a menu.
val hiddenFromProduction = GameCatalog.inMenu(GameMenu.BOARD, includeComingSoon = true) -
GameCatalog.inMenu(GameMenu.BOARD, includeComingSoon = false)
assertEquals(listOf(GameCatalog.byId(GameCatalog.CATAN)!!), hiddenFromProduction)
} }
@Test @Test