0.114.0 (versionCode 304): Comet Trail Constellations; Night Cap in Skydoku; the remaining approved Classic modes complete

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-09 10:02:02 +00:00
co-authored by Claude Opus 5.5
parent 69d9baa06e
commit 84fc494b6f
6 changed files with 202 additions and 14 deletions
@@ -103,4 +103,45 @@ class SnakeGameTest {
assertEquals(old, SnakeGame.nextFood(5, 4, body, r1))
assertNull(SnakeGame.nextFood(1, 2, listOf(SnakeCell(0, 0), SnakeCell(0, 1)), r1))
}
// ---------- Constellations (Phase 2) ----------
@Test fun constellationsStartWithWormholesAndTheFirstPattern() {
val g = SnakeGame.constellations(30, 22, java.util.Random(4), gentle = false)
assertEquals(2, g.wormholes.size); assertEquals(Constellations[0].second.size, g.pattern.size)
assertEquals(g.pattern.first(), g.food); assertEquals(0, g.maxLen)
assertTrue(g.pattern.none { it in g.body || it in g.wormholes })
// Classic has none of it.
val c = SnakeGame.start(30, 22, java.util.Random(4))
assertTrue(c.pattern.isEmpty() && c.wormholes.isEmpty())
assertEquals(STARDUST_LENGTH, SnakeGame.constellations(30, 22, java.util.Random(4), gentle = true).maxLen)
}
@Test fun starsInOrderLightTheConstellationAndLunaNamesIt() {
val r = java.util.Random(6)
var g = SnakeGame.constellations(30, 22, r, gentle = false)
val size = g.pattern.size
// Put each star just ahead of Blaze in turn.
repeat(size) {
val head = g.body.first()
val ahead = SnakeCell(head.x + g.wanted.dx, head.y + g.wanted.dy)
g = g.copy(pattern = g.pattern.toMutableList().also { p -> p[g.nextStar] = ahead }, food = ahead).step(r)
}
assertEquals(1, g.lit); assertEquals(Constellations[0].first, g.named)
assertEquals(1, g.constellation); assertEquals(0, g.nextStar); assertEquals(Constellations[1].second.size, g.pattern.size)
assertEquals(size * 10 + CONSTELLATION_BONUS * size, g.score)
}
@Test fun aWormholeTakesBlazeAcrossTheSky() {
val g = game(3 to 5, 2 to 5).copy(wormholes = listOf(SnakeCell(4, 5), SnakeCell(7, 2)))
val next = g.step(java.util.Random(1))
assertEquals(SnakeCell(7, 2), next.body.first()); assertTrue(next.alive)
}
@Test fun stardustKeepsTheTailShortOnGentle() {
var g = game(3 to 5, 2 to 5, food = 4 to 5).copy(maxLen = 3)
val r = java.util.Random(2)
repeat(4) { val h = g.body.first(); g = g.copy(food = SnakeCell(h.x + 1, h.y)).step(r) }
assertEquals(3, g.body.size)
}
}
@@ -90,7 +90,7 @@ class TitleTextFitsTest {
@Test fun theModeButtonSpellsEachModeOutInFull() {
// The mode's whole name on the button, after its ◆, in the title's 210 dp column.
val label = Font(Font.SANS_SERIF, Font.BOLD, 1).deriveFont(14f * 1.3f)
for (mode in listOf("Classic", "Signal Run", "Challenge", "Challenges", "40-Line Sprint", "Daily Challenge", "Daily · Draw Three", "Orbit Deck", "Showtime") + tv.orbit.classic.PairsMode.entries.map { it.title }) {
for (mode in listOf("Classic", "Signal Run", "Challenge", "Challenges", "40-Line Sprint", "Daily Challenge", "Daily · Draw Three", "Orbit Deck", "Showtime", "Broadcast", "Wind Down", "Constellations") + tv.orbit.classic.PairsMode.entries.map { it.title }) {
val w = width(label, "◆ $mode")
assertTrue("Mode · $mode is ${"%.0f".format(w)} dp", w <= 230 - 2 * 12 - 4)
}