Nite Owl's Night Shift (0.115.0, versionCode 305): five chapters of twelve hand-made levels, all bot-checked within par

- 7x5 night sky: Owl hops, OK turns the beam piece; light the mast; clouds drift a tile a hop; moves against Owl's par, no timer, no fail
- Title, chapter select, play and level complete from Stage B frames 40-43; shared pause; Back by context
- Per-profile progress (best stars and moves per level); High Scores keep total stars; Kids-suitable
- Levels from design/night-shift/make_levels.py, checked again by a bot in NightShiftLevelsTest
- Power-ups left out for Paul's call (they need the Menu key the remote lacks)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-09 10:17:59 +00:00
co-authored by Claude Opus 5.5
parent 84fc494b6f
commit 0c915fc118
11 changed files with 1176 additions and 10 deletions
@@ -85,9 +85,12 @@ internal object ArcadeGames {
listOf(GameSetting("sound", "Sound"), GameSetting("guide", "Guide line"), GameSetting("classicSkin", "Classic skin", default = false))) {
tv.orbit.classic.arcade.hive.BumbleHiveScreen(it)
}
// Playable from 9 November 2026: tv.orbit.classic.arcade.nightshift. Its High Scores keep the stars won across the chapters.
val NightShift: ArcadeGame = GameDef("NightShift", "Nite Owl's Night Shift", "Route the starlight", "Turn the beams and guide each lost star home.", Mascot.NiteOwl,
kidsSuitable = true, original = true, launchable = false, ScoreKind.FewestMoves, keepsLevels = true, legacyRecordKey = null,
listOf(Control("◀▶▲▼", "Hop"), Control("OK", "Turn a beam"), BackPause), "No timer and no fail: just Nite Owl's par.")
kidsSuitable = true, original = true, launchable = true, ScoreKind.Points, keepsLevels = true, legacyRecordKey = null,
listOf(Control("◀▶▲▼", "Hop"), Control("OK", "Turn the beam"), BackPause), "Light the mast. No timer and no fail: just Nite Owl's par.") {
tv.orbit.classic.arcade.nightshift.NightShiftScreen(it)
}
val Orbiteroids: ArcadeGame = GameDef("Orbiteroids", "Orbiteroids", "Zip clears the sky", "Fly Zip through the debris and keep the sky clear.", Mascot.Zip,
kidsSuitable = true, original = true, launchable = false, ScoreKind.Points, keepsLevels = false, legacyRecordKey = null,
listOf(Control("◀▶", "Turn"), Control("▲", "Thrust"), Control("OK", "Fire"), BackPause), "Clear each sector, and watch your hull.")
@@ -0,0 +1,198 @@
package tv.orbit.classic.arcade.nightshift
// Generated by design/night-shift/make_levels.py (9 November 2026): five chapters of twelve, each checked solvable there
// and again by NightShiftLevelsTest. Each row is 7 tiles of two characters: the piece (. empty, S star, M mast, I straight,
// L corner, T tee) and its quarter turns. Clouds: each lane's tiles, a cloud moving one along it (and back) a hop.
internal val NightChapters: List<NightChapter> = listOf(
NightChapter("First Light", listOf(
NightLevel(listOf("S1L1.0.0.0.0.0", ".0L0L0.0.0I0.0", ".0.0L1L3.0.0.0", ".0I3.0L0I3I1M0", ".0.0.0.0.0.0.0"),
solution = listOf("S1L2.0.0.0.0.0", ".0L0L2.0.0I3.0", ".0.0L0L2.0.0.0", ".0I1.0L0I1I1M0", ".0.0.0.0.0.0.0"),
par = 11, clouds = listOf()),
NightLevel(listOf(".0.0.0.0.0.0.0", ".0.0.0.0.0L1.0", ".0.0.0.0.0.0.0", "S1L0.0.0L3.0.0", ".0L2I1I1I1I2M0"),
solution = listOf(".0.0.0.0.0.0.0", ".0.0.0.0.0L2.0", ".0.0.0.0.0.0.0", "S1L2.0.0L2.0.0", ".0L0I1I1I1I1M0"),
par = 7, clouds = listOf()),
NightLevel(listOf(".0.0.0.0.0.0.0", "S1L3.0.0.0.0.0", ".0L0I1L1L0.0.0", ".0.0.0I1.0.0.0", ".0L2.0L1I1I2M0"),
solution = listOf(".0.0.0.0.0.0.0", "S1L2.0.0.0.0.0", ".0L0I1L2L2.0.0", ".0.0.0I0.0.0.0", ".0L3.0L0I1I1M0"),
par = 11, clouds = listOf()),
NightLevel(listOf(".0.0.0L2.0.0.0", "S1I1L1.0.0.0.0", ".0.0L0I0L0.0.0", ".0.0.0.0I0I3.0", "L1.0.0.0L0I1M0"),
solution = listOf(".0.0.0L3.0.0.0", "S1I1L2.0.0.0.0", ".0.0L0I1L2.0.0", ".0.0.0.0I0I0.0", "L2.0.0.0L0I1M0"),
par = 6, clouds = listOf()),
NightLevel(listOf(".0.0.0.0.0.0.0", ".0.0.0.0.0.0.0", ".0I1.0.0L3.0.0", ".0L3I2I2I3I0M0", "S1L2.0.0.0L3.0"),
solution = listOf(".0.0.0.0.0.0.0", ".0.0.0.0.0.0.0", ".0I2.0.0L0.0.0", ".0L1I1I1I1I1M0", "S1L3.0.0.0L1.0"),
par = 8, clouds = listOf()),
NightLevel(listOf("L3.0.0.0.0.0.0", ".0.0.0.0.0L1.0", ".0.0.0.0.0.0.0", "S1I2L0.0L2I3M0", ".0.0L3I3L2.0I0"),
solution = listOf("L1.0.0.0.0.0.0", ".0.0.0.0.0L0.0", ".0.0.0.0.0.0.0", "S1I1L2.0L1I1M0", ".0.0L0I1L3.0I3"),
par = 10, clouds = listOf()),
NightLevel(listOf(".0.0.0.0.0.0.0", ".0L2.0.0L1.0.0", ".0.0I0.0.0.0.0", "S2.0L2.0L0L3.0", "L2I0I3I0L2L2M0"),
solution = listOf(".0.0.0.0.0.0.0", ".0L3.0.0L2.0.0", ".0.0I3.0.0.0.0", "S2.0L0.0L1L2.0", "L0I1I1I1L3L0M0"),
par = 13, clouds = listOf()),
NightLevel(listOf("S1I2I0I2L3I2.0", ".0.0.0.0I2.0.0", ".0L3.0.0L2I0M0", ".0L2.0.0.0.0.0", "L1.0.0.0.0.0.0"),
solution = listOf("S1I1I1I1L2I3.0", ".0.0.0.0I0.0.0", ".0L0.0.0L0I1M0", ".0L1.0.0.0.0.0", "L3.0.0.0.0.0.0"),
par = 11, clouds = listOf()),
NightLevel(listOf(".0I0I2.0.0.0.0", ".0.0I3.0.0.0.0", ".0.0.0.0L0I2L0", "I2.0.0L2L2.0M0", "S1I2I2L1.0.0.0"),
solution = listOf(".0I3I1.0.0.0.0", ".0.0I2.0.0.0.0", ".0.0.0.0L1I1L2", "I3.0.0L1L3.0M0", "S1I1I1L3.0.0.0"),
par = 14, clouds = listOf()),
NightLevel(listOf("S1L3.0.0I2I0.0", "L3I1.0.0.0.0.0", "I0L2L0.0.0.0.0", ".0.0I1.0.0L3M0", "I0.0L3I3I0L1.0"),
solution = listOf("S1L2.0.0I3I3.0", "L1I0.0.0.0.0.0", "I3L0L2.0.0.0.0", ".0.0I0.0.0L1M0", "I2.0L0I1I1L3.0"),
par = 17, clouds = listOf()),
NightLevel(listOf("S2I0.0L2L2I3L0", "L2I0I2I3L1L1M0", ".0I2.0.0.0.0.0", ".0.0.0.0.0.0.0", ".0.0.0.0L0.0.0"),
solution = listOf("S2I1.0L0L1I1L2", "L0I1I1I1L3L3M0", ".0I1.0.0.0.0.0", ".0.0.0.0.0.0.0", ".0.0.0.0L2.0.0"),
par = 13, clouds = listOf()),
NightLevel(listOf("L2L0L1.0L2.0.0", "I2L2I3L1.0L1.0", "I2.0I0L3I2I2M0", "S0I2.0.0.0.0.0", ".0.0.0.0.0.0.0"),
solution = listOf("L1L2L0.0L0.0.0", "I0L0I1L2.0L3.0", "I0.0I2L0I1I1M0", "S0I0.0.0.0.0.0", ".0.0.0.0.0.0.0"),
par = 13, clouds = listOf()),
)),
NightChapter("The Quiet Mast", listOf(
NightLevel(listOf(".0L2I2I2L1T3.0", ".0I1.0.0L1L1.0", "S1L2.0.0.0L1M0", ".0L3.0.0.0I2.0", ".0I1I3.0.0.0.0"),
solution = listOf(".0L1I1I1L2T2.0", ".0I0.0.0L0L2.0", "S1L3.0.0.0L0M0", ".0L2.0.0.0I1.0", ".0I0I1.0.0.0.0"),
par = 17, clouds = listOf()),
NightLevel(listOf("S2.0.0.0L2.0I0", "I3.0.0.0.0.0.0", "L2I0I3I2I2I0M0", ".0.0.0.0L2T3.0", ".0.0.0.0.0.0L0"),
solution = listOf("S2.0.0.0L1.0I2", "I0.0.0.0.0.0.0", "L0I1I1I1I1I1M0", ".0.0.0.0L1T0.0", ".0.0.0.0.0.0L3"),
par = 9, clouds = listOf()),
NightLevel(listOf("S2.0L3.0.0.0.0", "L3L3.0.0.0.0.0", "L0I3.0.0.0.0L3", ".0L3I0I2I2I2M0", "I1.0.0.0.0.0T0"),
solution = listOf("S2.0L0.0.0.0.0", "L0L2.0.0.0.0.0", "L2I0.0.0.0.0L0", ".0L0I1I1I1I1M0", "I0.0.0.0.0.0T3"),
par = 15, clouds = listOf()),
NightLevel(listOf("S1I2I2L1.0T2.0", ".0.0.0L2I2I0M0", ".0.0.0.0.0.0T0", "L1I1.0.0.0.0.0", ".0I0.0.0.0T0.0"),
solution = listOf("S1I1I1L2.0T0.0", ".0.0.0L0I1I1M0", ".0.0.0.0.0.0T1", "L2I0.0.0.0.0.0", ".0I3.0.0.0T1.0"),
par = 9, clouds = listOf()),
NightLevel(listOf("T2.0.0.0.0L1.0", ".0I1.0.0.0.0.0", ".0.0.0L0.0I1M0", "S1I3L1L2I2I2L0", ".0.0L1L2.0.0L3"),
solution = listOf("T1.0.0.0.0L2.0", ".0I2.0.0.0.0.0", ".0.0.0L2.0I3M0", "S1I1L2L1I1I1L3", ".0.0L0L3.0.0L1"),
par = 15, clouds = listOf()),
NightLevel(listOf(".0.0.0.0T0.0.0", ".0.0L2.0L0.0M0", ".0.0.0L0I3I3L2", ".0.0L3L2.0.0T1", "S1I0L0.0I3.0T0"),
solution = listOf(".0.0.0.0T3.0.0", ".0.0L0.0L1.0M0", ".0.0.0L1I1I1L3", ".0.0L1L3.0.0T2", "S1I1L3.0I0.0T3"),
par = 11, clouds = listOf()),
NightLevel(listOf("I3.0I1.0.0.0.0", "L2L0.0L2I3I2M0", "I3L2I0L0I2.0.0", "I2.0L0I3.0.0.0", "S0L1.0.0.0.0L2"),
solution = listOf("I0.0I2.0.0.0.0", "L1L2.0L1I1I1M0", "I0L0I1L3I1.0.0", "I0.0L2I2.0.0.0", "S0L0.0.0.0.0L0"),
par = 18, clouds = listOf()),
NightLevel(listOf("L2L0.0.0.0.0.0", "S1I3L1L2I2I2M0", ".0.0L3L1I2.0.0", "I3L3.0.0T1.0I2", ".0.0.0.0.0.0.0"),
solution = listOf("L3L1.0.0.0.0.0", "S1I1L2L1I1I1M0", ".0.0L0L3I0.0.0", "I0L0.0.0T3.0I1", ".0.0.0.0.0.0.0"),
par = 11, clouds = listOf()),
NightLevel(listOf(".0.0I0I1.0I3L0", ".0.0.0.0.0.0.0", "S1L0L0I0I0L0M0", ".0L1L0.0T2L1L0", "I0.0.0L3.0.0.0"),
solution = listOf(".0.0I3I3.0I0L1", ".0.0.0.0.0.0.0", "S1L2L1I1I1L2M0", ".0L0L3.0T1L0L3", "I1.0.0L0.0.0.0"),
par = 21, clouds = listOf()),
NightLevel(listOf("L0L3.0.0L3I0.0", "I1L3I3I2I2I0M0", "S0L2.0T2I3.0.0", ".0.0I0.0.0.0L2", ".0.0.0.0I1.0.0"),
solution = listOf("L1L2.0.0L0I2.0", "I0L0I1I1I1I1M0", "S0L0.0T1I0.0.0", ".0.0I1.0.0.0L1", ".0.0.0.0I3.0.0"),
par = 11, clouds = listOf()),
NightLevel(listOf(".0L0I0I0I0I3M0", "L0L0T1L3.0.0.0", "I2.0.0.0.0L0T3", "L3L3L2I1.0T2I2", "S1L2.0.0.0.0.0"),
solution = listOf(".0L1I1I1I1I1M0", "L1L3T0L2.0.0.0", "I0.0.0.0.0L2T1", "L0L2L3I3.0T0I1", "S1L3.0.0.0.0.0"),
par = 15, clouds = listOf()),
NightLevel(listOf("S2.0L2I0L3.0L1", "I3.0I1T0L2L0.0", "L1I0L0T0L0L3L3", ".0.0T2.0.0I2M0", ".0.0I1.0.0.0I2"),
solution = listOf("S2.0L1I1L2.0L3", "I0.0I0T3L0L2.0", "L0I1L3T2L2L0L2", ".0.0T3.0.0I0M0", ".0.0I0.0.0.0I0"),
par = 26, clouds = listOf()),
)),
NightChapter("Cloudbank", listOf(
NightLevel(listOf(".0.0.0.0I3.0.0", ".0L0I3.0.0.0I2", "I0.0.0.0.0.0.0", "L2I0I0I2L0.0M0", "S0.0L1.0L3I0L2"),
solution = listOf(".0.0.0.0I1.0.0", ".0L3I2.0.0.0I0", "I2.0.0.0.0.0.0", "L1I1I1I1L2.0M0", "S0.0L0.0L0I1L3"),
par = 14, clouds = listOf(listOf(3 to 1, 3 to 2, 3 to 3))),
NightLevel(listOf(".0.0.0.0.0.0.0", "T3T3.0.0.0.0.0", "S2.0L2L2I3I3M0", "L3I0I0L0I1L0.0", ".0.0.0.0.0T1.0"),
solution = listOf(".0.0.0.0.0.0.0", "T1T2.0.0.0.0.0", "S2.0L1L1I1I1M0", "L0I1I1L3I3L2.0", ".0.0.0.0.0T3.0"),
par = 12, clouds = listOf(listOf(1 to 1, 1 to 2, 1 to 3))),
NightLevel(listOf(".0.0L3I2L0.0.0", ".0L0L2.0I1I2M0", "S1L1.0.0L1I3L2", "L0.0.0.0.0T2T0", ".0.0I3.0.0T0.0"),
solution = listOf(".0.0L1I1L2.0.0", ".0L1L3.0I0I1M0", "S1L3.0.0L0I1L3", "L3.0.0.0.0T0T2", ".0.0I2.0.0T1.0"),
par = 18, clouds = listOf(listOf(2 to 2, 3 to 2, 4 to 2, 5 to 2))),
NightLevel(listOf(".0.0.0.0.0I2.0", ".0L3.0.0L3.0M0", "S1L1.0I3.0.0I2", ".0L3I3I0L1L3L0", "I2I2.0.0L1L1L0"),
solution = listOf(".0.0.0.0.0I0.0", ".0L2.0.0L2.0M0", "S1L2.0I2.0.0I0", ".0L0I1I1L2L1L3", "I3I3.0.0L0L3L1"),
par = 17, clouds = listOf(listOf(3 to 4, 4 to 4, 5 to 4))),
NightLevel(listOf(".0.0.0.0.0L3.0", "L0L0.0.0I0.0.0", "L3L0.0.0I3I1M0", "I2L3I0I2I0I2L2", "S0T3.0.0.0.0.0"),
solution = listOf(".0.0.0.0.0L1.0", "L1L3.0.0I3.0.0", "L1L2.0.0I0I0M0", "I0L0I1I1I1I1L3", "S0T2.0.0.0.0.0"),
par = 13, clouds = listOf(listOf(1 to 1, 1 to 2, 1 to 3))),
NightLevel(listOf("S1I3I2L0L2L3M0", "I0.0.0L1L2L3L0", ".0.0.0.0.0.0.0", "L0L3.0.0.0.0.0", ".0.0.0I3T3L0I2"),
solution = listOf("S1I1I1L2L1L2M0", "I1.0.0L0L3L0L3", ".0.0.0.0.0.0.0", "L2L2.0.0.0.0.0", ".0.0.0I1T0L1I1"),
par = 20, clouds = listOf(listOf(3 to 0, 3 to 1, 3 to 2))),
NightLevel(listOf(".0.0.0.0T0.0I3", ".0L3I3I0L1L2M0", "S1L2I1.0L2L2.0", "I1L3.0.0.0.0.0", "I2.0T0I1.0.0.0"),
solution = listOf(".0.0.0.0T2.0I0", ".0L1I1I1L2L1M0", "S1L3I3.0L0L3.0", "I2L0.0.0.0.0.0", "I3.0T3I2.0.0.0"),
par = 15, clouds = listOf(listOf(0 to 1, 1 to 1, 2 to 1, 3 to 1), listOf(5 to 0, 5 to 1, 5 to 2))),
NightLevel(listOf(".0.0.0.0.0L1L3", ".0.0.0.0I2L0L3", ".0I3.0T3.0.0.0", ".0L0I2I2I3L0M0", "S1L0T3.0.0L1L1"),
solution = listOf(".0.0.0.0.0L0L1", ".0.0.0.0I1L2L2", ".0I1.0T0.0.0.0", ".0L1I1I1I1L2M0", "S1L3T0.0.0L0L3"),
par = 16, clouds = listOf(listOf(0 to 3, 1 to 3, 2 to 3, 3 to 3), listOf(4 to 1, 4 to 2, 4 to 3))),
NightLevel(listOf("I0I0I3.0.0.0I1", "L3L3L0I0.0.0M0", "S0L3I2L3.0.0I1", ".0L0.0L2I2I2L0", ".0.0.0.0I1.0.0"),
solution = listOf("I1I3I1.0.0.0I2", "L1L2L2I1.0.0M0", "S0L0I1L2.0.0I0", ".0L2.0L0I1I1L3", ".0.0.0.0I2.0.0"),
par = 22, clouds = listOf(listOf(0 to 1, 1 to 1, 2 to 1, 3 to 1), listOf(2 to 2, 3 to 2, 4 to 2, 5 to 2))),
NightLevel(listOf(".0L2L1I0.0L2L3", "L0L0L1I3I3I0M0", "I2T2L3.0.0L1T1", "I3.0.0.0.0.0.0", "S0.0.0.0.0I1T2"),
solution = listOf(".0L1L2I2.0L0L2", "L1L3L0I1I1I1M0", "I0T0L0.0.0L3T3", "I0.0.0.0.0.0.0", "S0.0.0.0.0I0T0"),
par = 23, clouds = listOf(listOf(1 to 0, 1 to 1, 1 to 2), listOf(5 to 0, 5 to 1, 5 to 2))),
NightLevel(listOf("T1.0.0I2L1.0.0", "L2I0L1I3T1.0I1", "S0L2L0.0I1.0M0", ".0L3I3I2I3I3L1", ".0.0L0.0L1.0.0"),
solution = listOf("T0.0.0I1L3.0.0", "L1I1L2I2T2.0I0", "S0L1L3.0I0.0M0", ".0L0I1I1I1I1L3", ".0.0L1.0L0.0.0"),
par = 19, clouds = listOf(listOf(1 to 0, 1 to 1, 1 to 2), listOf(3 to 1, 3 to 2, 3 to 3))),
NightLevel(listOf(".0.0I1.0.0.0L0", "L2L3I0L1L1.0.0", "S0I1.0L1.0.0.0", ".0L2L3.0L0I2M0", "I1I1L1I0L2.0L3"),
solution = listOf(".0.0I3.0.0.0L1", "L1L2I2L3L3.0.0", "S0I0.0L0.0.0.0", ".0L0L2.0L1I1M0", "I0I2L0I1L3.0L1"),
par = 22, clouds = listOf(listOf(5 to 1, 5 to 2, 5 to 3), listOf(2 to 1, 2 to 2, 2 to 3))),
)),
NightChapter("Northern Relay", listOf(
NightLevel(listOf("S1I2I2T2L0.0T1", ".0L2.0M0L2L1.0", ".0.0T0.0.0L1M0", ".0.0I1.0.0.0.0", "I2.0T0.0.0I2.0"),
solution = listOf("S1I1I1T1L2.0T3", ".0L1.0M0L0L2.0", ".0.0T2.0.0L0M0", ".0.0I2.0.0.0.0", "I1.0T1.0.0I1.0"),
par = 16, clouds = listOf(listOf(2 to 0, 2 to 1, 2 to 2), listOf(4 to 0, 4 to 1, 4 to 2))),
NightLevel(listOf(".0I3.0.0M0I2.0", "L3.0.0.0I3L1L0", ".0.0L0I2T0I2L0", "S1L1I3I0.0.0I1", ".0L1L1.0.0L3M0"),
solution = listOf(".0I1.0.0M0I3.0", "L0.0.0.0I0L0L3", ".0.0L1I1T3I1L2", "S1L2I0I3.0.0I0", ".0L0L3.0.0L0M0"),
par = 22, clouds = listOf(listOf(1 to 4, 2 to 4, 3 to 4, 4 to 4), listOf(3 to 0, 3 to 1, 3 to 2))),
NightLevel(listOf("T1.0.0M0.0.0L1", "I1L0L0T2I0I2M0", "T1L3L2.0.0.0.0", "L0L1.0.0I2.0.0", "S0.0I3.0.0.0.0"),
solution = listOf("T3.0.0M0.0.0L0", "I0L2L1T3I1I1M0", "T0L1L3.0.0.0.0", "L1L3.0.0I0.0.0", "S0.0I2.0.0.0.0"),
par = 13, clouds = listOf(listOf(0 to 3, 1 to 3, 2 to 3), listOf(0 to 1, 1 to 1, 2 to 1, 3 to 1))),
NightLevel(listOf("S2.0L3.0T3.0.0", "L3I0L0L3.0I1I3", ".0.0I2.0.0.0I2", ".0.0L1I2L0L3M0", ".0I0I1M0T2L2.0"),
solution = listOf("S2.0L0.0T2.0.0", "L0I1L2L1.0I2I2", ".0.0I0.0.0.0I3", ".0.0L0I1L2L1M0", ".0I1I0M0T3L3.0"),
par = 17, clouds = listOf(listOf(2 to 0, 2 to 1, 2 to 2), listOf(5 to 2, 5 to 3, 5 to 4))),
NightLevel(listOf(".0L3.0.0.0M0I3", "L3I3I0L3.0T1L1", "S0T1L3L1I3L1M0", ".0.0I1L3.0.0.0", ".0.0.0L0.0T0.0"),
solution = listOf(".0L0.0.0.0M0I0", "L1I1I1L2.0T0L2", "S0T3L0L0I1L3M0", ".0.0I2L0.0.0.0", ".0.0.0L1.0T3.0"),
par = 18, clouds = listOf(listOf(4 to 1, 5 to 1, 6 to 1), listOf(2 to 0, 2 to 1, 2 to 2))),
NightLevel(listOf("I2.0L3.0M0.0.0", ".0L2I2I2T1L0M0", "S1L2L2.0L1I3L1", "I3.0.0.0L2.0.0", ".0.0.0T1.0.0T1"),
solution = listOf("I3.0L0.0M0.0.0", ".0L1I1I1T2L2M0", "S1L3L3.0L0I1L3", "I0.0.0.0L1.0.0", ".0.0.0T2.0.0T0"),
par = 15, clouds = listOf(listOf(2 to 2, 3 to 2, 4 to 2, 5 to 2), listOf(1 to 1, 1 to 2, 1 to 3))),
NightLevel(listOf("L1L0I3T3I3M0M0", "L2L2L0L2I0I0L1", "S0L0.0.0.0.0.0", "L1.0.0.0T0I0L3", ".0.0.0.0I0.0L1"),
solution = listOf("L2L1I1T1I1M0M0", "L1L3L2L0I1I1L3", "S0L3.0.0.0.0.0", "L3.0.0.0T3I1L0", ".0.0.0.0I3.0L2"),
par = 16, clouds = listOf(listOf(0 to 1, 1 to 1, 2 to 1), listOf(3 to 0, 3 to 1, 3 to 2))),
NightLevel(listOf("M0T0I2L0.0.0M0", "L2L2.0L3I3I2L1", "S0I3I2.0.0T2I1", ".0T0.0.0L3.0.0", "I1.0.0L2L3.0.0"),
solution = listOf("M0T1I1L2.0.0M0", "L1L3.0L0I1I1L3", "S0I2I0.0.0T0I2", ".0T2.0.0L0.0.0", "I3.0.0L0L1.0.0"),
par = 15, clouds = listOf(listOf(5 to 0, 5 to 1, 5 to 2), listOf(3 to 0, 3 to 1, 3 to 2))),
NightLevel(listOf(".0L1I1I3I3.0L2", ".0.0.0L3I0I0.0", "S2.0.0.0I0.0.0", "L2I3L3.0.0L0L3", ".0M0T1I3I2L0M0"),
solution = listOf(".0L0I2I2I2.0L0", ".0.0.0L1I2I2.0", "S2.0.0.0I1.0.0", "L0I1L2.0.0L1L2", ".0M0T3I1I1L3M0"),
par = 18, clouds = listOf(listOf(3 to 3, 4 to 3, 5 to 3), listOf(2 to 2, 2 to 3, 2 to 4))),
NightLevel(listOf(".0.0I3.0.0.0.0", "L2I3M0I1T2.0.0", "L1.0I2L3.0I1.0", "S2L2T0I0L0.0M0", "L3L0L1L2L2I0L2"),
solution = listOf(".0.0I2.0.0.0.0", "L0I1M0I0T1.0.0", "L0.0I0L2.0I3.0", "S2L1T3I1L2.0M0", "L0L3L3L3L0I1L3"),
par = 23, clouds = listOf(listOf(4 to 1, 4 to 2, 4 to 3), listOf(3 to 2, 3 to 3, 3 to 4))),
NightLevel(listOf("L2L1I1L1L3M0I0", "S0L3I0I2I0T3M0", ".0.0L2L1.0L3L1", "I1.0.0.0.0.0.0", "T3.0I2.0T1.0.0"),
solution = listOf("L1L2I0L0L0M0I1", "S0L0I1I1I1T2M0", ".0.0L0L2.0L0L3", "I3.0.0.0.0.0.0", "T2.0I3.0T0.0.0"),
par = 19, clouds = listOf(listOf(1 to 0, 1 to 1, 1 to 2), listOf(3 to 0, 3 to 1, 3 to 2))),
NightLevel(listOf("S1L1.0L3L1L0L1", ".0T2L0L3I2L1M0", "I0I3L2L0.0L2L2", ".0M0.0.0T0T0.0", ".0.0I2.0.0L2L3"),
solution = listOf("S1L2.0L2L2L2L3", ".0T0L2L1I1L2M0", "I3I0L0L3.0L0L3", ".0M0.0.0T2T3.0", ".0.0I1.0.0L0L1"),
par = 21, clouds = listOf(listOf(5 to 0, 5 to 1, 5 to 2), listOf(2 to 0, 2 to 1, 2 to 2))),
)),
NightChapter("Last Light Before Dawn", listOf(
NightLevel(listOf("I0I3.0.0I3.0.0", "L3.0.0.0L2.0.0", "L3.0M0.0.0L3.0", "S2L2T0I2I2L0.0", "L2L2.0L2L1L2M0"),
solution = listOf("I3I2.0.0I2.0.0", "L2.0.0.0L1.0.0", "L2.0M0.0.0L2.0", "S2L1T3I1I1L2.0", "L0L3.0L3L2L0M0"),
par = 19, clouds = listOf(listOf(3 to 1, 3 to 2, 3 to 3), listOf(1 to 2, 1 to 3, 1 to 4))),
NightLevel(listOf("I1L3.0.0L0I3M0", ".0I0.0L3L1T2.0", "T3.0L2T3.0L0.0", "L0I2L2I3T2.0T3", "S0.0.0M0L2.0.0"),
solution = listOf("I3L1.0.0L1I1M0", ".0I2.0L1L3T1.0", "T2.0L1T2.0L1.0", "L1I1L3I0T3.0T2", "S0.0.0M0L3.0.0"),
par = 20, clouds = listOf(listOf(5 to 0, 5 to 1, 5 to 2), listOf(2 to 2, 2 to 3, 2 to 4))),
NightLevel(listOf("S1I3T3I0M0.0L1", ".0.0I1.0.0T1L1", ".0L2I2T3.0L0.0", ".0.0L3L1.0.0L3", "T0.0I0L2I0I0M0"),
solution = listOf("S1I1T1I1M0.0L3", ".0.0I0.0.0T2L3", ".0L1I0T1.0L1.0", ".0.0L0L2.0.0L2", "T2.0I2L0I1I1M0"),
par = 17, clouds = listOf(listOf(5 to 2, 5 to 3, 5 to 4), listOf(3 to 2, 3 to 3, 3 to 4))),
NightLevel(listOf("I1I3.0M0.0.0.0", "S2I1.0I3.0.0.0", "L1I2I0T2I0L0M0", "I1L3.0L1.0L2L2", ".0T1.0I3.0L3L1"),
solution = listOf("I3I2.0M0.0.0.0", "S2I3.0I0.0.0.0", "L0I1I1T3I1L2M0", "I2L2.0L2.0L0L3", ".0T2.0I1.0L0L2"),
par = 17, clouds = listOf(listOf(2 to 1, 2 to 2, 2 to 3), listOf(5 to 1, 5 to 2, 5 to 3))),
NightLevel(listOf("S2.0I2T0L1.0.0", "I3I1L2I2M0.0.0", "L1I2L0.0I3L0M0", ".0.0L3I3T0I3L2", "I1L3.0.0.0L0.0"),
solution = listOf("S2.0I3T2L0.0.0", "I0I2L0I1M0.0.0", "L0I1L2.0I0L1M0", ".0.0L0I1T3I1L3", "I0L0.0.0.0L1.0"),
par = 21, clouds = listOf(listOf(3 to 1, 3 to 2, 3 to 3), listOf(5 to 1, 5 to 2, 5 to 3))),
NightLevel(listOf(".0L3T3L0.0L3L3", "S1L1I3L1I0L1M0", "I2.0M0.0I0.0.0", "I0.0I3.0.0I2I1", ".0.0L1T2I0.0I1"),
solution = listOf(".0L1T1L2.0L1L2", "S1L3I0L0I1L3M0", "I3.0M0.0I1.0.0", "I3.0I0.0.0I3I2", ".0.0L2T3I3.0I0"),
par = 25, clouds = listOf(listOf(3 to 0, 3 to 1, 3 to 2), listOf(5 to 0, 5 to 1, 5 to 2))),
NightLevel(listOf(".0M0I2T3I3L1M0", "L1L0I0L0L0L1L2", "S1L2.0.0.0L0L3", "I1.0.0.0.0L2.0", ".0I0L3I1L2I3.0"),
solution = listOf(".0M0I1T1I1L2M0", "L2L1I1L3L1L0L3", "S1L3.0.0.0L2L0", "I0.0.0.0.0L0.0", ".0I3L2I3L0I2.0"),
par = 18, clouds = listOf(listOf(2 to 0, 2 to 1, 2 to 2), listOf(5 to 0, 5 to 1, 5 to 2))),
NightLevel(listOf(".0I2L1.0I1.0T1", ".0.0.0L2.0T1.0", "L2I3L0T1M0.0L2", "S0L3L1I2T0L3M0", ".0.0.0T1L3L1L1"),
solution = listOf(".0I0L3.0I0.0T3", ".0.0.0L1.0T0.0", "L1I1L2T2M0.0L0", "S0L0L0I1T3L2M0", ".0.0.0T2L0L0L3"),
par = 24, clouds = listOf(listOf(1 to 3, 2 to 3, 3 to 3, 4 to 3), listOf(5 to 2, 5 to 3, 5 to 4))),
NightLevel(listOf("S2T1.0.0I3.0T1", "I3I3I0I2.0I3.0", "L3L1M0I3.0L0L3", ".0L2T1I0I0L0M0", "L3.0.0.0T0L1.0"),
solution = listOf("S2T0.0.0I0.0T3", "I0I1I1I3.0I0.0", "L0L2M0I1.0L1L2", ".0L0T3I1I1L3M0", "L0.0.0.0T2L0.0"),
par = 20, clouds = listOf(listOf(4 to 1, 4 to 2, 4 to 3), listOf(0 to 1, 1 to 1, 2 to 1))),
NightLevel(listOf("L0L3L0T3I2M0L2", "I2L3L0L3I3I2M0", "I1.0L1L2T0I2L1", "S0T2.0.0.0L3.0", "L3L3I2.0.0T2.0"),
solution = listOf("L1L2L1T1I1M0L3", "I0L0L3L0I1I1M0", "I0.0L3L3T2I0L0", "S0T1.0.0.0L1.0", "L0L1I1.0.0T1.0"),
par = 23, clouds = listOf(listOf(2 to 0, 2 to 1, 2 to 2), listOf(1 to 0, 1 to 1, 1 to 2))),
NightLevel(listOf("S2L2L0.0I3.0I0", "I1L0L0I2L0L0.0", "L3L2T1I2L2I3.0", "T2.0I1L2I1L3L0", "L2L3M0L2L3.0M0"),
solution = listOf("S2L1L3.0I0.0I2", "I0L1L2I0L1L2.0", "L0L3T0I1L3I0.0", "T0.0I0L1I2L0L2", "L0L1M0L3L1.0M0"),
par = 29, clouds = listOf(listOf(3 to 1, 4 to 1, 5 to 1, 6 to 1), listOf(3 to 3, 4 to 3, 5 to 3, 6 to 3))),
NightLevel(listOf("S1L3.0L0L0L2M0", ".0I1L1.0.0.0I2", "I2T3I0I0I0L1I3", "I3I2I3T3I3L1L2", "L2M0.0.0I2.0L0"),
solution = listOf("S1L2.0L1L3L0M0", ".0I0L0.0.0.0I0", "I0T0I1I1I1L2I0", "I2I0I2T0I2L0L3", "L1M0.0.0I3.0L2"),
par = 23, clouds = listOf(listOf(3 to 3, 4 to 3, 5 to 3, 6 to 3), listOf(3 to 0, 3 to 1, 3 to 2))),
)),
)
@@ -0,0 +1,138 @@
package tv.orbit.classic.arcade.nightshift
import tv.orbit.classic.arcade.Difficulty
/**
* Nite Owl's Night Shift (Stage B frames 40–43, 9 November 2026): a calm puzzle for the late shift. A 7 × 5 night sky; Nite
* Owl hops tile to tile and OK turns the beam piece under him, routing the lost star's light to the relay mast. Clouds drift
* a tile along their lanes each hop and block the light where they sit. Moves (turns) against Owl's par: no timer, no fail.
* The game has no screen in it, so it can be tested.
*/
internal const val NW = 7
internal const val NH = 5
/** A side of a tile, as a bit: north, east, south, west. */
internal const val SIDE_N = 1
internal const val SIDE_E = 2
internal const val SIDE_S = 4
internal const val SIDE_W = 8
private val Sides = intArrayOf(SIDE_N, SIDE_E, SIDE_S, SIDE_W)
private val Dx = intArrayOf(0, 1, 0, -1)
private val Dy = intArrayOf(-1, 0, 1, 0)
private fun opposite(side: Int) = when (side) { SIDE_N -> SIDE_S; SIDE_S -> SIDE_N; SIDE_E -> SIDE_W; else -> SIDE_E }
/** A piece's sides when unturned: a straight (north–south), a corner (north–east), a tee, the star (beam north), the mast (all). */
internal fun baseSides(piece: Char) = when (piece) { 'I' -> SIDE_N or SIDE_S; 'L' -> SIDE_N or SIDE_E; 'T' -> SIDE_N or SIDE_E or SIDE_S; 'S' -> SIDE_N; 'M' -> 15; else -> 0 }
/** The sides of [piece] turned [turns] quarters clockwise. */
internal fun sides(piece: Char, turns: Int): Int {
if (piece == 'M') return 15
var m = baseSides(piece)
repeat(((turns % 4) + 4) % 4) { m = ((m shl 1) or (m shr 3)) and 15 }
return m
}
/** Only these turn under OK: the star and the mast stay put. */
internal fun turnable(piece: Char) = piece == 'I' || piece == 'L' || piece == 'T'
internal class NightLevel(val rows: List<String>, val solution: List<String>, val par: Int, val clouds: List<List<Pair<Int, Int>>>) {
fun piece(i: Int) = rows[i / NW][i % NW * 2]
fun turns(i: Int) = rows[i / NW][i % NW * 2 + 1] - '0'
}
internal class NightChapter(val name: String, val levels: List<NightLevel>)
/** Owl's par for a difficulty: a little more room on Gentle, a little less on Tricky (never below what it really takes). */
internal fun nightPar(level: NightLevel, d: Difficulty) = when (d) { Difficulty.Gentle -> level.par + 3; Difficulty.Normal -> level.par; Difficulty.Tricky -> level.par - 1 }
/** Stars for a finished level: three on or under par, two a little over, one however long it took. */
internal fun nightStars(moves: Int, par: Int) = when { moves <= par -> 3; moves <= par + maxOf(3, par / 3) -> 2; else -> 1 }
/** Where a cloud on [lane] is after [hops] hops: along the lane and back again. */
internal fun cloudAt(lane: List<Pair<Int, Int>>, hops: Int): Int {
if (lane.size == 1) return lane[0].second * NW + lane[0].first
val period = 2 * lane.size - 2
val k = hops % period
val p = if (k < lane.size) lane[k] else lane[period - k]
return p.second * NW + p.first
}
/** One level being played. Turns count as moves; hops don't, but each hop moves the clouds on. */
internal class NightGame(val level: NightLevel, val turns: IntArray = IntArray(NW * NH) { level.turns(it) }, val owl: Int = start(level), val moves: Int = 0, val hops: Int = 0) {
fun piece(i: Int) = level.piece(i)
/** Nite Owl hops to the next tile, if there is one; the clouds drift on a tile. */
fun hop(dx: Int, dy: Int): NightGame {
val x = owl % NW + dx; val y = owl / NW + dy
if (x !in 0 until NW || y !in 0 until NH) return this
return NightGame(level, turns, y * NW + x, moves, hops + 1)
}
/** OK: the piece under Nite Owl turns a quarter, clockwise. Nothing there to turn, nothing happens. */
fun turn(): NightGame {
if (!turnable(piece(owl))) return this
val t = turns.copyOf(); t[owl] = (t[owl] + 1) % 4
return NightGame(level, t, owl, moves + 1, hops)
}
/** The tiles a cloud sits on now ([at] hops), each blocking the light. */
fun cloudTiles(at: Int = hops): IntArray = IntArray(level.clouds.size) { cloudAt(level.clouds[it], at) }
/** Every tile the light reaches: from the star along its beam, through pieces whose sides meet; clouds stop it. */
fun lit(): BooleanArray {
val on = BooleanArray(NW * NH)
val clouds = cloudTiles()
val star = (0 until NW * NH).first { piece(it) == 'S' }
on[star] = true
val todo = IntArray(NW * NH); var n = 0; todo[n++] = star
while (n > 0) {
val i = todo[--n]
val here = sides(piece(i), turns[i])
for (k in 0..3) {
if (here and Sides[k] == 0) continue
val x = i % NW + Dx[k]; val y = i / NW + Dy[k]
if (x !in 0 until NW || y !in 0 until NH) continue
val j = y * NW + x
if (on[j] || clouds.contains(j)) continue
if (sides(piece(j), turns[j]) and opposite(Sides[k]) == 0) continue
on[j] = true; todo[n++] = j
}
}
return on
}
val masts get() = (0 until NW * NH).filter { piece(it) == 'M' }
/** Every mast lit: the star's home. */
val won get() = lit().let { on -> masts.all { on[it] } }
companion object {
/** Nite Owl starts beside the star. */
fun start(level: NightLevel): Int { val s = (0 until NW * NH).first { level.piece(it) == 'S' }; return if (s % NW + 1 < NW) s + 1 else s - 1 }
}
}
/** Where a profile has got to: each level's best (stars and moves), saved in the game's level progress. */
internal object NightProgress {
fun key(chapter: Int, level: Int) = "ns.$chapter.$level"
fun best(saved: Map<String, String>, chapter: Int, level: Int): Pair<Int, Int>? =
saved[key(chapter, level)]?.split(',')?.let { p -> p.getOrNull(0)?.toIntOrNull()?.let { s -> s to (p.getOrNull(1)?.toIntOrNull() ?: 0) } }
fun done(saved: Map<String, String>, chapter: Int) = NightChapters[chapter].levels.indices.count { best(saved, chapter, it) != null }
fun stars(saved: Map<String, String>, chapter: Int) = NightChapters[chapter].levels.indices.sumOf { best(saved, chapter, it)?.first ?: 0 }
fun totalStars(saved: Map<String, String>) = NightChapters.indices.sumOf { stars(saved, it) }
/** A chapter opens when the one before is finished; the first is always open. */
fun open(saved: Map<String, String>, chapter: Int) = chapter == 0 || done(saved, chapter - 1) == NightChapters[chapter - 1].levels.size
/** A level opens when the one before it in its chapter is done. */
fun levelOpen(saved: Map<String, String>, chapter: Int, level: Int) = open(saved, chapter) && (level == 0 || best(saved, chapter, level - 1) != null)
/** Where Continue goes: the first level not yet done in the furthest open chapter, or the very last. */
fun next(saved: Map<String, String>): Pair<Int, Int> {
for (c in NightChapters.indices) {
if (!open(saved, c)) break
val l = NightChapters[c].levels.indices.firstOrNull { best(saved, c, it) == null }
if (l != null) return c to l
}
return NightChapters.lastIndex to NightChapters.last().levels.lastIndex
}
/** A level's best after a finish: more stars, or the same stars in fewer moves. */
fun better(old: Pair<Int, Int>?, stars: Int, moves: Int) = old == null || stars > old.first || (stars == old.first && moves < old.second)
fun value(stars: Int, moves: Int) = "$stars,$moves"
}
@@ -0,0 +1,453 @@
package tv.orbit.classic.arcade.nightshift
import android.view.KeyEvent
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.focusable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawWithCache
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.focus.onFocusChanged
import androidx.compose.ui.geometry.CornerRadius
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Path
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.drawscope.DrawScope
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.tv.material3.Text
import tv.orbit.classic.Anton
import tv.orbit.classic.Motion
import tv.orbit.classic.arcade.ArcadeButton
import tv.orbit.classic.arcade.ArcadeColours
import tv.orbit.classic.arcade.ArcadeGames
import tv.orbit.classic.arcade.ArcadeKey
import tv.orbit.classic.arcade.ArcadePauseMenu
import tv.orbit.classic.arcade.ArcadePlay
import tv.orbit.classic.arcade.Control
import tv.orbit.classic.arcade.HowToPlayCard
import tv.orbit.classic.arcade.KeyFooter
import tv.orbit.classic.arcade.RunEnd
import tv.orbit.classic.arcade.gameKeys
import tv.orbit.classic.arcade.onBackKey
import tv.orbit.classic.drawNightCap
import tv.orbit.classic.drawNiteOwl
import tv.orbit.classic.starPath
/** Night Shift's own colours (frames 40–43): muted indigo, nothing bright but the starlight. */
internal object NightColours {
val Top = Color(0xFF0D1140)
val Bottom = Color(0xFF2A1F5E)
val Tile = Color(0xFF262C6B)
val TileEdge = Color(0xFF3A428C)
val Beam = Color(0xFF4A55A8)
val Lit = Color(0xFFE9E6FF)
val Glow = Color(0xFF9AA6FF)
val Star = Color(0xFFFFE9A8)
val Ink = Color(0xFFE6E2FF)
val Muted = Color(0xFFA9A4D9)
val Panel = Color(0xFF1B1D55)
}
/** The night sky behind every Night Shift screen: drawn once, in its own layer. */
private fun Modifier.nightSky(): Modifier = graphicsLayer().drawWithCache {
val rnd = java.util.Random(999)
val stars = FloatArray(120 * 3) { k -> when (k % 3) { 0 -> rnd.nextFloat() * size.width; 1 -> rnd.nextFloat() * size.height; else -> .6f + rnd.nextFloat() * 1.3f } }
val sky = Brush.verticalGradient(listOf(NightColours.Top, NightColours.Bottom))
onDrawBehind {
drawRect(sky)
for (i in 0 until 120) drawCircle(Color.White.copy(alpha = .15f + stars[i * 3 + 2] / 6), stars[i * 3 + 2], Offset(stars[i * 3], stars[i * 3 + 1]))
}
}
private enum class NightStage { Title, Chapters, Play, Complete }
/** Nite Owl's lines when a level's done, by stars (frame 42). */
internal fun owlLine(stars: Int) = when (stars) { 3 -> "Right on par. Very tidy."; 2 -> "Took the scenic route, did we?"; else -> "Got there in the end. The stars don't mind." }
internal fun parLine(moves: Int, par: Int) = when {
moves < par -> "${par - moves} under par. Show-off."
moves == par -> "Bang on Owl's par."
moves - par == 1 -> "One over par. The stars don't mind."
else -> "${words(moves - par)} over par. The stars don't mind."
}
private fun words(n: Int) = listOf("Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten").getOrElse(n) { "$n" }
@Composable
internal fun NightShiftScreen(play: ArcadePlay) {
val gameDef = ArcadeGames.NightShift
val latestPlay by rememberUpdatedState(play)
// The profile's progress, kept here as it changes (the Arcade saves it with each finished level).
var saved by remember { mutableStateOf(play.level) }
var stage by remember { mutableStateOf(NightStage.Title) }
var chapter by remember { mutableIntStateOf(NightProgress.next(play.level).first) }
var levelIx by remember { mutableIntStateOf(NightProgress.next(play.level).second) }
var game by remember { mutableStateOf(NightGame(NightChapters[chapter].levels[levelIx])) }
var paused by remember { mutableStateOf(false) }
var howTo by remember { mutableStateOf(false) }
var finished by remember { mutableStateOf<Triple<Int, Int, Int>?>(null) } // stars, moves, par
val par = nightPar(game.level, play.difficulty)
val focus = remember { FocusRequester() }
fun startLevel(c: Int, l: Int) { chapter = c; levelIx = l; game = NightGame(NightChapters[c].levels[l]); paused = false; finished = null; stage = NightStage.Play }
// A finished level: its best saved (more stars, or fewer moves), and the profile's total stars in the High Scores.
LaunchedEffect(game) {
if (stage != NightStage.Play || !game.won) return@LaunchedEffect
val stars = nightStars(game.moves, par)
val old = NightProgress.best(saved, chapter, levelIx)
if (NightProgress.better(old, stars, game.moves)) {
val v = NightProgress.value(maxOf(stars, old?.first ?: 0), if (old != null && old.first > stars) old.second else game.moves)
saved = saved + (NightProgress.key(chapter, levelIx) to v)
latestPlay.setLevel(NightProgress.key(chapter, levelIx), v)
}
latestPlay.onRunEnd(RunEnd(NightProgress.totalStars(saved), finished = true, detail = "Ch ${chapter + 1} · Level ${levelIx + 1}"))
finished = Triple(stars, game.moves, par)
stage = NightStage.Complete
}
LaunchedEffect(stage, paused) { if (stage == NightStage.Play && !paused) runCatching { focus.requestFocus() } }
BackHandler(stage == NightStage.Play && !paused) { paused = true }
Box(Modifier.fillMaxSize().nightSky()) {
when (stage) {
NightStage.Title -> {
NightTitle(saved, refocus = !howTo, onContinue = { NightProgress.next(saved).let { (c, l) -> startLevel(c, l) } },
onChapters = { stage = NightStage.Chapters }, onHowTo = { howTo = true }, onBack = { latestPlay.onLeave() })
if (howTo) HowToPlayCard(gameDef, firstRun = false, everyTime = null, onEveryTime = {}, onPlay = { howTo = false }, onBack = { howTo = false })
}
NightStage.Chapters -> NightChaptersPage(saved, chapter, onPlay = ::startLevel, onBack = { stage = NightStage.Title })
NightStage.Play, NightStage.Complete -> {
val keys = Modifier.focusRequester(focus).focusable().gameKeys(enabled = stage == NightStage.Play && !paused, pause = { paused = true }) { key, native ->
if (native.action != KeyEvent.ACTION_DOWN) return@gameKeys key != ArcadeKey.Other
val next = when (key) {
ArcadeKey.Left -> game.hop(-1, 0)
ArcadeKey.Right -> game.hop(1, 0)
ArcadeKey.Up -> game.hop(0, -1)
ArcadeKey.Down -> game.hop(0, 1)
ArcadeKey.Ok -> if (native.repeatCount > 0) game else game.turn()
else -> null
}
if (next != null) game = next
next != null
}
NightPlay(game, chapter, levelIx, par, keys, still = Motion.reduce || play.reduceFlashing)
if (stage == NightStage.Complete) finished?.let { (stars, moves, p) ->
NightComplete(chapter, levelIx, stars, moves, p, last = chapter == NightChapters.lastIndex && levelIx == NightChapters[chapter].levels.lastIndex,
onNext = {
val c = chapter; val l = levelIx
if (l + 1 < NightChapters[c].levels.size) startLevel(c, l + 1)
else if (c + 1 < NightChapters.size && NightProgress.open(saved, c + 1)) startLevel(c + 1, 0)
else { chapter = c; stage = NightStage.Chapters }
},
onReplay = { startLevel(chapter, levelIx) }, onChapters = { stage = NightStage.Chapters })
}
if (paused && stage == NightStage.Play) ArcadePauseMenu(gameDef, "Chapter ${chapter + 1} · Level ${levelIx + 1} · ${game.moves} moves",
onResume = { paused = false }, onRestart = { startLevel(chapter, levelIx) }, onExit = { latestPlay.onLeave() },
extra = "Chapters" to { paused = false; stage = NightStage.Chapters })
}
}
}
}
// ---------- Title (frame 40) ----------
@Composable
private fun NightTitle(saved: Map<String, String>, refocus: Boolean, onContinue: () -> Unit, onChapters: () -> Unit, onHowTo: () -> Unit, onBack: () -> Unit) {
val first = remember { FocusRequester() }
LaunchedEffect(refocus) { if (refocus) runCatching { first.requestFocus() } }
val (nc, nl) = NightProgress.next(saved)
Box(Modifier.fillMaxSize().onBackKey(action = onBack)) {
BackHandler(onBack = onBack)
// The moon, a constellation or two, and Nite Owl on his mast sending the star home.
Canvas(Modifier.fillMaxSize()) {
val w = size.width; val h = size.height
drawCircle(Color(0xFFD9D4FF).copy(alpha = .12f), h * .12f, Offset(w * .92f, h * .13f))
drawCircle(Color(0xFFD9D4FF), h * .062f, Offset(w * .92f, h * .13f)); drawCircle(NightColours.Top, h * .055f, Offset(w * .935f, h * .115f))
val c1 = listOf(.61f to .11f, .65f to .17f, .69f to .14f, .73f to .2f, .77f to .175f)
for (i in 1 until c1.size) drawLine(NightColours.Muted.copy(alpha = .6f), Offset(w * c1[i - 1].first, h * c1[i - 1].second), Offset(w * c1[i].first, h * c1[i].second), 1.5f)
c1.forEach { (x, y) -> drawCircle(Color.White, 3f, Offset(w * x, h * y)) }
val mastTop = Offset(w * .395f, h * .6f); val mastFoot = h * .82f
drawOval(Color(0xFF15164A), Offset(w * .21f, h * .79f), Size(w * .37f, h * .08f))
mast(mastTop, mastFoot - mastTop.y, NightColours.Glow)
val star = Offset(w * .15f, h * .48f)
drawLine(NightColours.Glow.copy(alpha = .35f), star, mastTop - Offset(0f, h * .06f), 10f, StrokeCap.Round)
drawLine(NightColours.Lit, star, mastTop - Offset(0f, h * .06f), 3f, StrokeCap.Round)
drawCircle(NightColours.Star.copy(alpha = .25f), h * .05f, star)
drawPath(starPath(star, h * .028f, h * .012f, 0f), NightColours.Star)
drawNiteOwl(mastTop - Offset(0f, h * .1f), h * .1f, lid = .45f)
}
Column(Modifier.fillMaxSize().padding(start = 48.dp, end = 48.dp, top = 40.dp, bottom = 12.dp)) {
Row(Modifier.fillMaxWidth().weight(1f)) {
Column(Modifier.weight(1f)) {
Text("NITE OWL'S", color = NightColours.Muted, fontSize = 18.sp, letterSpacing = 6.sp)
Text("NIGHT SHIFT", color = NightColours.Ink, fontFamily = Anton, fontSize = 64.sp)
Text("A calm puzzle for the late shift. No timer, no rush.", color = NightColours.Muted, fontSize = 15.sp)
Spacer(Modifier.weight(1f))
Text("CHAPTERS", color = NightColours.Muted, fontSize = 14.sp, letterSpacing = 3.sp)
Row(Modifier.padding(vertical = 6.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
for (c in NightChapters.indices) {
val open = NightProgress.open(saved, c); val done = NightProgress.done(saved, c) == NightChapters[c].levels.size
Box(Modifier.size(28.dp).background(if (c == nc) Color(0xFF5865D8) else if (done) NightColours.Tile else NightColours.Panel, CircleShape)
.border(1.dp, if (open) NightColours.Glow else NightColours.TileEdge, CircleShape), contentAlignment = Alignment.Center) {
Text(if (open) "${c + 1}" else "🔒", color = NightColours.Ink, fontSize = if (open) 13.sp else 10.sp)
}
}
}
Text(chapterStatus(saved), color = NightColours.Muted, fontSize = 14.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
}
Column(Modifier.width(270.dp).align(Alignment.CenterVertically), verticalArrangement = Arrangement.spacedBy(8.dp)) {
ArcadeButton("Continue", Modifier.fillMaxWidth().focusRequester(first), icon = "▶", detail = "Ch ${nc + 1} · Level ${nl + 1}", primary = true, height = 34.dp, onClick = onContinue)
ArcadeButton("Chapters", Modifier.fillMaxWidth(), icon = "☰", height = 34.dp, onClick = onChapters)
ArcadeButton("How to Play", Modifier.fillMaxWidth(), icon = "?", height = 34.dp, onClick = onHowTo)
ArcadeButton("Back to Arcade", Modifier.fillMaxWidth(), icon = "←", height = 34.dp, onClick = onBack)
}
}
KeyFooter(listOf(Control("▲▼", "Choose"), Control("OK", "Select"), Control("Back", "Arcade home")))
}
}
}
/** "First Light done · The Quiet Mast in progress" under the title's chapters. */
internal fun chapterStatus(saved: Map<String, String>): String {
val parts = ArrayList<String>()
for (c in NightChapters.indices) {
val done = NightProgress.done(saved, c)
if (done == NightChapters[c].levels.size) parts += "${NightChapters[c].name} done"
else if (done > 0 || (NightProgress.open(saved, c) && parts.isNotEmpty())) { parts += "${NightChapters[c].name} in progress"; break }
else if (c == 0) { parts += "First Light awaits"; break }
}
return parts.takeLast(2).joinToString(" · ")
}
/** The relay mast: a lattice tower, [top] its peak, [height] tall. */
private fun DrawScope.mast(top: Offset, height: Float, colour: Color) {
val half = height * .3f
val l = Offset(top.x - half, top.y + height); val r = Offset(top.x + half, top.y + height)
val stroke = maxOf(1.5f, height / 90f)
drawLine(colour, top, l, stroke); drawLine(colour, top, r, stroke)
for (k in 1..4) {
val f = k / 4.5f; val g = (k - 1) / 4.5f
val a = top + (l - top) * f; val b = top + (r - top) * f
drawLine(colour, a, b, stroke)
drawLine(colour, top + (l - top) * g, b, stroke); drawLine(colour, top + (r - top) * g, a, stroke)
}
}
// ---------- Chapters (frame 43) ----------
@Composable
private fun NightChaptersPage(saved: Map<String, String>, current: Int, onPlay: (Int, Int) -> Unit, onBack: () -> Unit) {
var shown by remember { mutableIntStateOf(current) }
val firstCard = remember { FocusRequester() }
LaunchedEffect(Unit) { runCatching { firstCard.requestFocus() } }
Box(Modifier.fillMaxSize().onBackKey(action = onBack)) {
BackHandler(onBack = onBack)
Column(Modifier.fillMaxSize().padding(start = 32.dp, end = 32.dp, top = 28.dp, bottom = 12.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) {
Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically) {
Column(Modifier.weight(1f)) {
Text("NITE OWL'S NIGHT SHIFT", color = NightColours.Muted, fontSize = 14.sp, letterSpacing = 4.sp)
Text("CHOOSE A CHAPTER", color = NightColours.Ink, fontFamily = Anton, fontSize = 34.sp)
}
Text("Pick up where\nwe left off?", Modifier.background(NightColours.Ink, RoundedCornerShape(12.dp)).padding(horizontal = 12.dp, vertical = 6.dp),
color = NightColours.Top, fontSize = 14.sp, fontWeight = FontWeight.SemiBold, textAlign = TextAlign.Center)
Canvas(Modifier.size(64.dp)) { drawNiteOwl(center, size.minDimension * .4f, lid = .45f) }
}
Row(Modifier.fillMaxWidth().height(160.dp), horizontalArrangement = Arrangement.spacedBy(10.dp)) {
for (c in NightChapters.indices) {
val open = NightProgress.open(saved, c)
var focused by remember { mutableStateOf(false) }
val corner = RoundedCornerShape(10.dp)
Column(Modifier.weight(1f).fillMaxHeight().then(if (c == current) Modifier.focusRequester(firstCard) else Modifier)
.onFocusChanged { focused = it.isFocused; if (it.isFocused) shown = c }
.background(if (focused) Color(0xFF3B3F9E) else NightColours.Panel, corner).border(if (focused) 3.dp else 1.dp, if (focused) ArcadeColours.Yellow else NightColours.TileEdge, corner)
.clickable { if (open) onPlay(c, NightProgress.next(saved).let { (nc, nl) -> if (nc == c) nl else 0 }) }) {
Canvas(Modifier.fillMaxWidth().height(56.dp)) {
// The chapter's constellation (locked: faint, with a padlock).
val pts = List(5) { k -> Offset(size.width * (.2f + k * .15f), size.height * (.4f + .25f * kotlin.math.sin(k * 1.7 + c).toFloat())) }
for (k in 1 until pts.size) drawLine(NightColours.Muted.copy(alpha = if (open) .8f else .3f), pts[k - 1], pts[k], 1.5f)
pts.forEach { drawCircle(Color.White.copy(alpha = if (open) 1f else .35f), 3.5f, it) }
}
Column(Modifier.padding(horizontal = 12.dp, vertical = 6.dp)) {
Text("CHAPTER ${c + 1}", color = NightColours.Muted, fontSize = 13.sp, letterSpacing = 2.sp)
Text(NightChapters[c].name.uppercase(), color = if (open) NightColours.Ink else NightColours.Muted, fontFamily = Anton, fontSize = 17.sp, maxLines = 2, lineHeight = 19.sp)
Spacer(Modifier.weight(1f))
Text(if (open) "${NightProgress.done(saved, c)} of ${NightChapters[c].levels.size} levels" else "Opens after", color = NightColours.Ink, fontSize = 13.sp)
Text(if (open) "${NightProgress.stars(saved, c)} of ${NightChapters[c].levels.size * 3} stars" else "Chapter $c", color = NightColours.Muted, fontSize = 13.sp)
}
}
}
}
// The chosen chapter's levels: done, the next, and the rest still dark.
Column(Modifier.fillMaxWidth().background(NightColours.Panel, RoundedCornerShape(12.dp)).border(1.dp, NightColours.TileEdge, RoundedCornerShape(12.dp)).padding(14.dp),
verticalArrangement = Arrangement.spacedBy(10.dp)) {
Row { Text("Chapter ${shown + 1}: ${NightChapters[shown].name}", color = NightColours.Ink, fontSize = 15.sp, fontWeight = FontWeight.SemiBold)
Text(" ${NightProgress.done(saved, shown)} of ${NightChapters[shown].levels.size} levels · par is a guide, not a rule", color = NightColours.Muted, fontSize = 13.sp) }
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
for (l in NightChapters[shown].levels.indices) {
val open = NightProgress.levelOpen(saved, shown, l); val best = NightProgress.best(saved, shown, l)
var focused by remember(shown) { mutableStateOf(false) }
Box(Modifier.size(38.dp).onFocusChanged { focused = it.isFocused }
.background(if (focused) Color(0xFF5865D8) else if (best != null) NightColours.Tile else NightColours.Panel, CircleShape)
.border(if (focused) 3.dp else 1.dp, if (focused) ArcadeColours.Yellow else if (open) NightColours.Glow else NightColours.TileEdge, CircleShape)
.clickable(enabled = open) { onPlay(shown, l) }, contentAlignment = Alignment.Center) {
Text("${l + 1}", color = if (open) NightColours.Ink else NightColours.Muted, fontSize = 14.sp, fontWeight = FontWeight.SemiBold)
}
}
}
}
Spacer(Modifier.weight(1f))
KeyFooter(listOf(Control("◀▶", "Choose a chapter"), Control("▼", "Levels"), Control("OK", "Play"), Control("Back", "Title")))
}
}
}
// ---------- Play (frame 41) ----------
@Suppress("ModifierParameter") // [keys] is the screen's key handling, not a layout modifier
@Composable
private fun NightPlay(game: NightGame, chapter: Int, level: Int, par: Int, keys: Modifier, still: Boolean) {
val on = remember(game) { game.lit() }
val clouds = remember(game) { game.cloudTiles() }
val nextClouds = remember(game) { game.cloudTiles(game.hops + 1) }
Column(Modifier.fillMaxSize().then(keys).padding(start = 32.dp, end = 32.dp, top = 22.dp, bottom = 10.dp)) {
Row(Modifier.fillMaxWidth().weight(1f), horizontalArrangement = Arrangement.spacedBy(18.dp)) {
Column(Modifier.width(176.dp).fillMaxHeight(), verticalArrangement = Arrangement.spacedBy(2.dp)) {
Text("CHAPTER ${chapter + 1} · LEVEL ${level + 1}", color = NightColours.Muted, fontSize = 14.sp, letterSpacing = 2.sp, maxLines = 1)
Text(NightChapters[chapter].name.uppercase(), color = NightColours.Ink, fontFamily = Anton, fontSize = 22.sp, maxLines = 2, lineHeight = 24.sp)
Spacer(Modifier.height(8.dp))
Row(horizontalArrangement = Arrangement.spacedBy(18.dp)) {
Column { Text("MOVES", color = NightColours.Muted, fontSize = 14.sp, letterSpacing = 2.sp); Text("${game.moves}", color = NightColours.Ink, fontFamily = Anton, fontSize = 30.sp) }
Column { Text("OWL'S PAR", color = NightColours.Muted, fontSize = 14.sp, letterSpacing = 2.sp); Text("$par", color = Color(0xFFC9C3FF), fontFamily = Anton, fontSize = 30.sp) }
}
Spacer(Modifier.height(6.dp))
Text("STARS", color = NightColours.Muted, fontSize = 14.sp, letterSpacing = 2.sp)
val s = nightStars(game.moves, par)
Row(verticalAlignment = Alignment.CenterVertically) {
Canvas(Modifier.size(84.dp, 24.dp)) { for (k in 0 until 3) { val c = Offset(12f + k * 28.dp.toPx() * .95f, size.height / 2); if (k < s) drawPath(starPath(c, 10.dp.toPx(), 4.dp.toPx(), 0f), NightColours.Star) else drawPath(starPath(c, 10.dp.toPx(), 4.dp.toPx(), 0f), NightColours.Muted, style = Stroke(1.5f)) } }
Text("if you finish now", color = NightColours.Muted, fontSize = 13.sp)
}
Spacer(Modifier.height(8.dp))
Text("No timer. Take your time.", color = NightColours.Muted, fontSize = 15.sp)
if (game.level.clouds.isNotEmpty()) Text("Clouds drift a tile each hop and hide the light.", color = NightColours.Muted, fontSize = 14.sp)
}
Box(Modifier.weight(1f).fillMaxHeight(), contentAlignment = Alignment.Center) {
Canvas(Modifier.fillMaxHeight().aspectRatio(NW / NH.toFloat()).background(NightColours.Panel.copy(alpha = .6f), RoundedCornerShape(14.dp))
.border(1.dp, NightColours.TileEdge, RoundedCornerShape(14.dp)).padding(8.dp)) { drawBoard(game, on, clouds, nextClouds, still) }
}
Column(Modifier.width(110.dp).fillMaxHeight(), horizontalAlignment = Alignment.End) {
Spacer(Modifier.weight(1f))
// Luna in her Night Cap keeps Nite Owl company.
Canvas(Modifier.size(80.dp)) { drawNightCap(center + Offset(0f, size.height * .08f), size.minDimension * .34f) }
}
}
Spacer(Modifier.height(6.dp))
KeyFooter(listOf(Control("◀▶▲▼", "Hop"), Control("OK", "Turn the beam"), Control("Back", "Pause")))
}
}
/** The board: tiles, beam pieces (lit where the light reaches), the star and mast, the clouds and where they go next, and Nite Owl. */
private fun DrawScope.drawBoard(game: NightGame, on: BooleanArray, clouds: IntArray, nextClouds: IntArray, still: Boolean) {
val cell = minOf(size.width / NW, size.height / NH)
val ox = (size.width - cell * NW) / 2; val oy = (size.height - cell * NH) / 2
val pad = cell * .05f
for (i in 0 until NW * NH) {
val x = ox + i % NW * cell; val y = oy + i / NW * cell
drawRoundRect(NightColours.Tile.copy(alpha = .8f), Offset(x + pad, y + pad), Size(cell - 2 * pad, cell - 2 * pad), CornerRadius(cell * .14f))
// Where a cloud goes next: a dashed outline, so a hop is never a surprise.
if (nextClouds.contains(i) && !clouds.contains(i))
drawRoundRect(NightColours.Muted.copy(alpha = .55f), Offset(x + pad * 2.5f, y + pad * 2.5f), Size(cell - 5 * pad, cell - 5 * pad), CornerRadius(cell * .1f),
style = Stroke(1.5f, pathEffect = androidx.compose.ui.graphics.PathEffect.dashPathEffect(floatArrayOf(6f, 5f))))
val c = Offset(x + cell / 2, y + cell / 2)
val p = game.piece(i)
when (p) {
'S' -> {
val dirs = sides(p, game.turns[i])
beam(c, dirs, cell, NightColours.Lit, true)
drawCircle(NightColours.Star.copy(alpha = .28f), cell * .36f, c)
drawPath(starPath(c, cell * .26f, cell * .11f, 0f), NightColours.Star)
}
'M' -> mast(Offset(c.x, c.y - cell * .34f), cell * .66f, if (on[i]) NightColours.Lit else NightColours.Glow.copy(alpha = .7f))
'.' -> if ((i * 7) % 5 == 0) drawCircle(Color.White.copy(alpha = .25f), 1.6f, Offset(x + cell * .3f, y + cell * .3f))
else -> beam(c, sides(p, game.turns[i]), cell, if (on[i]) NightColours.Lit else NightColours.Beam, on[i])
}
}
// Clouds: soft puffs over their tiles.
for (t in clouds) {
val c = Offset(ox + t % NW * cell + cell / 2, oy + t / NW * cell + cell / 2)
val cloud = Color(0xFFB8B4E6).copy(alpha = .85f)
drawCircle(cloud, cell * .2f, c + Offset(-cell * .14f, cell * .04f)); drawCircle(cloud, cell * .24f, c + Offset(cell * .04f, -cell * .04f))
drawCircle(cloud, cell * .18f, c + Offset(cell * .2f, cell * .06f)); drawRect(cloud, c + Offset(-cell * .3f, cell * .04f), Size(cell * .6f, cell * .16f))
}
// Nite Owl on his tile, ringed, with the turn sign when there's a piece to turn.
val o = Offset(ox + game.owl % NW * cell + cell / 2, oy + game.owl / NW * cell + cell / 2)
drawRoundRect(NightColours.Ink.copy(alpha = .9f), Offset(o.x - cell / 2 + pad, o.y - cell / 2 + pad), Size(cell - 2 * pad, cell - 2 * pad), CornerRadius(cell * .14f), style = Stroke(2.5f))
drawNiteOwl(o, cell * .34f, lid = .45f)
if (turnable(game.piece(game.owl))) {
val b = Offset(o.x + cell * .3f, o.y + cell * .3f)
drawCircle(NightColours.Top, cell * .13f, b); drawCircle(NightColours.Ink, cell * .13f, b, style = Stroke(2f))
drawArc(NightColours.Ink, -60f, 270f, false, Offset(b.x - cell * .07f, b.y - cell * .07f), Size(cell * .14f, cell * .14f), style = Stroke(2f))
}
}
/** A beam piece: a pipe from the centre to each of its sides, with a node in the middle; lit, it glows. */
private fun DrawScope.beam(c: Offset, dirs: Int, cell: Float, colour: Color, lit: Boolean) {
val reach = cell * .5f
val ends = arrayOf(Offset(0f, -reach), Offset(reach, 0f), Offset(0f, reach), Offset(-reach, 0f))
for (k in 0..3) if (dirs and (1 shl k) != 0) {
if (lit) drawLine(NightColours.Glow.copy(alpha = .35f), c, c + ends[k], cell * .16f, StrokeCap.Round)
drawLine(colour, c, c + ends[k], cell * .07f, StrokeCap.Round)
}
drawCircle(if (lit) NightColours.Glow else NightColours.Beam, cell * .11f, c)
drawCircle(colour, cell * .11f, c, style = Stroke(cell * .03f))
}
// ---------- Level complete (frame 42) ----------
@Composable
private fun NightComplete(chapter: Int, level: Int, stars: Int, moves: Int, par: Int, last: Boolean, onNext: () -> Unit, onReplay: () -> Unit, onChapters: () -> Unit) {
val first = remember { FocusRequester() }
LaunchedEffect(Unit) { runCatching { first.requestFocus() } }
BackHandler(onBack = onChapters)
Box(Modifier.fillMaxSize().onBackKey(action = onChapters).background(NightColours.Top.copy(alpha = .8f)), contentAlignment = Alignment.Center) {
Row(Modifier.width(600.dp).background(NightColours.Panel, RoundedCornerShape(16.dp)).border(1.dp, NightColours.TileEdge, RoundedCornerShape(16.dp)).padding(22.dp),
horizontalArrangement = Arrangement.spacedBy(16.dp)) {
Canvas(Modifier.size(110.dp)) { drawNiteOwl(center, size.minDimension * .4f, lid = if (stars == 3) 0f else .25f, glance = .3f) }
Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {
Text("CHAPTER ${chapter + 1} · LEVEL ${level + 1} COMPLETE", color = NightColours.Muted, fontSize = 13.sp, letterSpacing = 2.sp)
Text(NightChapters[chapter].name.uppercase(), color = NightColours.Ink, fontFamily = Anton, fontSize = 30.sp)
Text(owlLine(stars), Modifier.background(NightColours.Ink, RoundedCornerShape(12.dp)).padding(horizontal = 12.dp, vertical = 6.dp),
color = NightColours.Top, fontSize = 15.sp, fontWeight = FontWeight.SemiBold)
Row(verticalAlignment = Alignment.CenterVertically) {
Canvas(Modifier.size(96.dp, 30.dp)) { for (k in 0 until 3) { val c = Offset(15.dp.toPx() + k * 32.dp.toPx(), size.height / 2); if (k < stars) drawPath(starPath(c, 13.dp.toPx(), 5.dp.toPx(), 0f), NightColours.Star) else drawPath(starPath(c, 13.dp.toPx(), 5.dp.toPx(), 0f), NightColours.Muted, style = Stroke(2f)) } }
Text("$stars of 3 stars", color = NightColours.Ink, fontSize = 15.sp, fontWeight = FontWeight.SemiBold)
}
Row(horizontalArrangement = Arrangement.spacedBy(18.dp), verticalAlignment = Alignment.Bottom) {
Text("MOVES", color = NightColours.Muted, fontSize = 14.sp, letterSpacing = 2.sp); Text("$moves", color = NightColours.Ink, fontFamily = Anton, fontSize = 26.sp)
Text("OWL'S PAR", color = NightColours.Muted, fontSize = 14.sp, letterSpacing = 2.sp); Text("$par", color = Color(0xFFC9C3FF), fontFamily = Anton, fontSize = 26.sp)
}
Text(parLine(moves, par), color = NightColours.Muted, fontSize = 14.sp)
Row(horizontalArrangement = Arrangement.spacedBy(10.dp)) {
ArcadeButton(if (last) "Chapters" else "Next Level", Modifier.width(150.dp).focusRequester(first), icon = "▶", primary = true, height = 34.dp, onClick = if (last) onChapters else onNext)
ArcadeButton("Replay", Modifier.width(120.dp), icon = "↻", height = 34.dp, onClick = onReplay)
if (!last) ArcadeButton("Chapters", Modifier.width(140.dp), icon = "☰", height = 34.dp, onClick = onChapters)
}
}
}
KeyFooter(listOf(Control("◀▶", "Choose"), Control("OK", "Select"), Control("Back", "Chapters")), Modifier.align(Alignment.BottomStart).padding(start = 24.dp, end = 24.dp, bottom = 10.dp))
}
}