Star Chase Signal Run (0.112.0, versionCode 302): four channel mazes, the Channel Switch, its own High Scores

- Four channel mazes as glowing cables, sharing the den, start and tunnel; no lone walls or dead ends
- A remote pickup flips the maze to the next channel; stars stay, the cast lose track for a moment
- About a third quicker; Blaze charges on sight, Zip cuts ahead, Drift wanders, Luna guards the remote
- Mode tables generalised from BumbleHive Hard: each mode its own High Scores, stepped with ◀▶
- Classic Star Chase unchanged

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-09 09:35:17 +00:00
co-authored by Claude Opus 5.5
parent 88cc20e27f
commit 764b97fd07
11 changed files with 363 additions and 55 deletions
+2 -2
View File
@@ -9,8 +9,8 @@ android {
applicationId = "tv.orbit.classic"
minSdk = 26
targetSdk = 36
versionCode = 301
versionName = "0.111.0-classics-family"
versionCode = 302
versionName = "0.112.0-signal-run"
}
buildFeatures { compose = true }
// The finished build for the TVs (Paul, 6 November 2026: the test build stuttered on the box). Not debuggable, so
@@ -18,6 +18,7 @@ import tv.orbit.classic.arcade.classicPace
import tv.orbit.classic.arcade.classicPanel
import tv.orbit.classic.arcade.gameKeys
import tv.orbit.classic.arcade.previousLine
import tv.orbit.classic.arcade.ORBMAN_SIGNAL_SCORES
import tv.orbit.classic.arcade.PauseWhenHidden
import tv.orbit.classic.arcade.RunEnd
import tv.orbit.classic.arcade.loopRuns
@@ -88,6 +89,30 @@ private val OrbMazeLeft = listOf(
internal val OrbMazeRows: List<String> = OrbMazeLeft.map { left -> left + left.substring(0, left.length - 1).reversed().replace('P', '.') }
/**
* Signal Run's four mazes (Phase 2, 9 November 2026): one per channel, Orbit 1, Riot, Terra and Tots, drawn as glowing
* cables in its colour. All four share the den, its door, Ollie's start and the side tunnel, so a Channel Switch never
* strands anyone; R marks where the remote turns up. Like Classic's, no wall stands alone and no corridor is a dead end.
*/
private val SignalMazeLefts = listOf(
listOf("############", "#o.........#", "#.###.####.#", "#.###.####..", "#....R......", "#.##.##.###-", "..##....##HH",
"#.#...#.####", "#.#.###.....", "#...#...###.", "#.###.#.....", "#o....#....P", "############"),
listOf("############", "#o...#.....#", "#.#..#.###.#", "#.#....###..", "#...##.R....", "##..##..###-", "......#.##HH",
"#.###.#.####", "#.....#.....", "#.##.###.##.", "#.##.....##.", "#o...#.....P", "############"),
listOf("############", "#o..#......#", "#.#.#.####.#", "#.#........R", "#.####.##...", "#....#..###-", "..##.#..##HH",
"#..#.#..####", "##.#........", "#..#.###.#..", "#.##.#...#..", "#o.....#...P", "############"),
listOf("############", "#o.........#", "#.##.#.###.#", "#.##.#.....R", "#....#.##...", "###.##.####-", ".......###HH",
"#.#.##.#####", "#.#..#.#....", "#.##.....##.", "#......#.##.", "#o.....#...P", "############"))
internal val SignalMazes: List<OrbMaze> = SignalMazeLefts.map { half -> OrbMaze(half.map { left -> left + left.substring(0, left.length - 1).reversed().replace('P', '.') }) }
/** The four channels' names and cable colours, in the order a Channel Switch goes through them. */
internal val SignalChannels = listOf("Orbit 1" to Color(0xFF35D6F2), "Riot" to Color(0xFFFF2EA6), "Terra" to Color(0xFF9BE564), "Tots" to Color(0xFFFFB52E))
/** Ticks before a used remote turns up again, and how long the cast stay lost after a switch. */
internal const val REMOTE_BACK_TICKS = 600
internal const val LOST_TICKS = 150
internal data class OrbPos(val x: Int, val y: Int)
internal enum class OrbDir(val dx: Int, val dy: Int) {
@@ -113,6 +138,19 @@ internal class OrbMaze(val rows: List<String> = OrbMazeRows) {
val doorCell get() = cells('-').single()
/** Just outside the door, where a rock heads to leave the den. */
val outside get() = OrbPos(doorCell.x, doorCell.y - 1)
/** A corridor square: not a wall, the door or the den. */
fun open(p: OrbPos) = p.y in 0 until height && !wall(p) && !door(p) && !den(p)
/** The corridor square nearest [p] (itself if it's one), skipping [taken]: where things land when the maze changes under them. */
fun nearestOpen(p: OrbPos, taken: Set<OrbPos> = emptySet()): OrbPos {
if (open(p) && p !in taken) return p
val seen = HashSet<OrbPos>(); val queue = ArrayDeque<OrbPos>(); queue += p; seen += p
while (queue.isNotEmpty()) {
val c = queue.removeFirst()
if (open(c) && c !in taken) return c
for (d in OrbDir.entries) { val n = OrbPos(Math.floorMod(c.x + d.dx, width), c.y + d.dy); if (n.y in 0 until height && seen.add(n)) queue += n }
}
return start
}
}
/** Where a moving thing is, and where it came from this step, for drawing it in between. */
@@ -126,7 +164,7 @@ internal data class OrbChaser(val mover: OrbMover, val home: OrbPos, val release
/** Out of the den and on the loose. */
val out: Boolean = false)
internal enum class OrbEvent { Star, Power, Catch, Caught, Cleared }
internal enum class OrbEvent { Star, Power, Catch, Caught, Cleared, Switch }
internal data class OrbGame(
val maze: OrbMaze, val player: OrbMover, val wanted: OrbDir, val chasers: List<OrbChaser>,
@@ -139,10 +177,23 @@ internal data class OrbGame(
/** A moment's pause before play: the start, after being caught, and between levels. */
val readyLeft: Int = READY_TICKS,
val alive: Boolean = true,
val events: List<OrbEvent> = emptyList()) {
val events: List<OrbEvent> = emptyList(),
/** Signal Run (a mode of its own; Classic leaves all of these at their defaults and plays exactly as before). */
val signal: Boolean = false,
/** Which of the four channels' mazes is showing. */
val channel: Int = 0,
/** The remote, where it waits to be picked up, or null while it's away. */
val remote: OrbPos? = null,
/** Ticks until the remote turns up again. */
val remoteIn: Int = 0,
/** Ticks the cast stay lost after a Channel Switch: they wander, with no idea where Ollie went. */
val lostLeft: Int = 0,
/** Channel Switches so far, for where the remote turns up next. */
val switches: Int = 0) {
val playerEvery get() = (8 - (level - 1) / 2).coerceAtLeast(6)
val chaserEvery get() = (10 - (level - 1)).coerceAtLeast(7)
// Signal Run glides about a third quicker, and its cast keep up.
val playerEvery get() = if (signal) (6 - (level - 1) / 3).coerceAtLeast(4) else (8 - (level - 1) / 2).coerceAtLeast(6)
val chaserEvery get() = if (signal) (8 - (level - 1) / 2).coerceAtLeast(5) else (10 - (level - 1)).coerceAtLeast(7)
val powerTicks get() = (400 - 40 * (level - 1)).coerceAtLeast(150)
val powered get() = powerLeft > 0
@@ -170,6 +221,12 @@ internal data class OrbGame(
chasers = chasers.map { c -> if (c.returning || !c.out) c else c.copy(scared = true, mover = c.mover.copy(dir = c.mover.dir.opposite)) }
}
g = g.copy(player = moved, stars = stars, powers = powers, score = score, chasers = chasers, powerLeft = powerLeft, chain = chain)
// Signal Run: Ollie grabs the remote and the maze flips to the next channel's.
if (signal && g.remote == moved.pos) { events += OrbEvent.Switch; g = g.switched() }
}
if (signal) {
if (g.lostLeft > 0) g = g.copy(lostLeft = g.lostLeft - 1)
if (g.remote == null && g.remoteIn > 0) g = g.copy(remoteIn = g.remoteIn - 1).let { if (it.remoteIn == 0) it.copy(remote = it.remoteSpot()) else it }
}
g = g.copy(chasers = g.chasers.mapIndexed { i, c -> g.moveChaser(i, c, t, random) })
// Caught, or catching: on the same square, or passing through each other.
@@ -191,17 +248,39 @@ internal data class OrbGame(
}
if (result.stars.isEmpty() && result.powers.isEmpty()) {
events += OrbEvent.Cleared
return start(maze, result.level + 1, result.score, result.lives).copy(events = events)
return (if (signal) signalStart(result.level + 1, result.score, result.lives, channel = result.channel, switches = result.switches) else start(maze, result.level + 1, result.score, result.lives)).copy(events = events)
}
return result.copy(events = events)
}
/** Where the remote turns up in this maze: its R squares, taking turns. */
fun remoteSpot(): OrbPos? = maze.cells('R').let { spots -> if (spots.isEmpty()) null else spots[switches % spots.size] }
/**
* The Channel Switch: the next channel's maze, walls opening and closing. Stars and power hexagons stay where they are,
* any now inside a wall moved to the nearest free corridor; Ollie and the cast likewise. The cast lose track of him for
* a moment, and the remote is away for a while.
*/
internal fun switched(): OrbGame {
val next = (channel + 1) % SignalMazes.size
val m = SignalMazes[next]
val stars2 = HashSet<OrbPos>(); for (st in stars) stars2 += m.nearestOpen(st, stars2)
val powers2 = HashSet<OrbPos>(); for (pw in powers) powers2 += m.nearestOpen(pw, powers2 + stars2)
val p = m.nearestOpen(player.pos)
val chasers2 = chasers.map { c ->
if (!c.out || c.returning) c else { val at = m.nearestOpen(c.mover.pos); c.copy(mover = OrbMover(at, at, c.mover.dir, tick)) }
}
return copy(maze = m, channel = next, stars = stars2, powers = powers2, player = OrbMover(p, p, player.dir, tick), chasers = chasers2,
remote = null, remoteIn = REMOTE_BACK_TICKS, lostLeft = LOST_TICKS, switches = switches + 1, score = score + 100)
}
/** Everyone back to their places for another go; the stars stay as they are. */
private fun restart(lives: Int) = copy(lives = lives, player = OrbMover(maze.start, maze.start, OrbDir.Left, tick), wanted = OrbDir.Left,
chasers = chasersAtHome(maze, tick), powerLeft = 0, chain = 0, readyLeft = READY_TICKS)
private fun moveChaser(index: Int, c: OrbChaser, t: Int, random: java.util.Random): OrbChaser {
val every = when { c.returning -> 4; c.scared -> chaserEvery + 6; !c.out -> chaserEvery + 4; else -> chaserEvery }
val charging = signal && index == 0 && c.out && !c.scared && !c.returning && lostLeft == 0 && inSight(c.mover.pos)
val every = when { c.returning -> 4; c.scared -> chaserEvery + 6; !c.out -> chaserEvery + 4; charging -> (chaserEvery - 2).coerceAtLeast(3); else -> chaserEvery }
if (t - c.mover.movedAt < every) return c
if (!c.out && !c.returning && t < c.releaseAt) return c
val target = when {
@@ -214,7 +293,9 @@ internal data class OrbGame(
val choices = OrbDir.entries.filter { passable(maze.step(c.mover.pos, it)) }
val forward = choices.filter { it != c.mover.dir.opposite }.ifEmpty { choices }
if (forward.isEmpty()) return c.copy(mover = c.mover.copy(from = c.mover.pos, movedAt = t))
val dir = if (c.scared) forward[random.nextInt(forward.size)]
// Lost after a Channel Switch, or Drift drifting: a turning at random.
val wandering = signal && c.out && !c.returning && (lostLeft > 0 || (index == 2 && random.nextInt(3) > 0))
val dir = if (c.scared || wandering) forward[random.nextInt(forward.size)]
else forward.minBy { d -> maze.step(c.mover.pos, d).let { (it.x - target.x) * (it.x - target.x) + (it.y - target.y) * (it.y - target.y) } }
val next = maze.step(c.mover.pos, dir)
val mover = OrbMover(next, c.mover.pos, dir, t)
@@ -225,9 +306,24 @@ internal data class OrbGame(
}
}
/** Whether [from] sees Ollie straight along a row or column with no wall between: Blaze's cue to charge. */
internal fun inSight(from: OrbPos): Boolean {
val p = player.pos
if (from.y == p.y) { val a = minOf(from.x, p.x); val b = maxOf(from.x, p.x); return (a..b).none { maze.wall(OrbPos(it, p.y)) } }
if (from.x == p.x) { val a = minOf(from.y, p.y); val b = maxOf(from.y, p.y); return (a..b).none { maze.wall(OrbPos(p.x, it)) } }
return false
}
/** Each rock has its own way of hunting. */
private fun chaseTarget(index: Int, c: OrbChaser): OrbPos {
val p = player.pos; val d = player.dir
// Signal Run: Blaze charges straight at him, Zip cuts in further ahead, Drift drifts (see moveChaser), Luna guards the remote.
if (signal) return when (index) {
0 -> p
1 -> OrbPos(p.x + 4 * d.dx, p.y + 4 * d.dy)
2 -> p
else -> remote ?: stars.minByOrNull { abs(it.x - p.x) + abs(it.y - p.y) } ?: p
}
return when (index) {
// Blaze: straight for Ollie.
0 -> p
@@ -250,6 +346,12 @@ internal data class OrbGame(
else { val home = den[(i - 1) % den.size]; OrbChaser(OrbMover(home, home, OrbDir.Up, tick), home, tick + READY_TICKS + i * 150) }
}
}
/** A Signal Run level: the channel's maze (it carries on from the last), full of stars, the remote waiting. */
fun signalStart(level: Int = 1, score: Int = 0, lives: Int = 3, channel: Int = 0, switches: Int = 0): OrbGame {
val m = SignalMazes[channel]
val g = start(m, level, score, lives).copy(signal = true, channel = channel, switches = switches)
return g.copy(remote = g.remoteSpot())
}
fun start(maze: OrbMaze = OrbMaze(), level: Int = 1, score: Int = 0, lives: Int = 3): OrbGame =
OrbGame(maze, OrbMover(maze.start, maze.start, OrbDir.Left), OrbDir.Left, chasersAtHome(maze, 0), maze.cells('.').toSet(), maze.cells('o').toSet(),
score = score, lives = lives, level = level)
@@ -412,18 +514,38 @@ internal fun DrawScope.drawOrbField(game: OrbGame, phase: Float = 0f, glow: Floa
drawRect(OrbFloor, origin, Size(cell * maze.width, cell * maze.height))
if (glow > 0f) drawRect(Brush.radialGradient(listOf(Color(0xFF6EF0FF).copy(alpha = .28f * glow), Color(0xFF6EF0FF).copy(alpha = .06f * glow)),
centre(game.player.pos), maxOf(size.width, size.height) * .7f), origin, Size(cell * maze.width, cell * maze.height))
// Walls as solid blocks with a bright edge wherever they face a corridor, so every wall reads as part of the maze.
val fill = if (glow > 0f) androidx.compose.ui.graphics.lerp(OrbWallFill, Color(0xFF0E5A78), glow * .6f) else OrbWallFill
val edge = if (glow > 0f) androidx.compose.ui.graphics.lerp(OrbWallLight, Color(0xFF7FF3FF), glow * .6f) else OrbWallLight
// Walls as solid blocks with a bright edge wherever they face a corridor, so every wall reads as part of the maze. In Signal
// Run they're the channel's broadcast cables: its colour, glowing.
val cable = if (game.signal) SignalChannels[game.channel].second else null
val baseFill = if (cable != null) androidx.compose.ui.graphics.lerp(OrbFloor, cable, .28f) else OrbWallFill
val baseEdge = cable ?: OrbWallLight
val fill = if (glow > 0f) androidx.compose.ui.graphics.lerp(baseFill, Color(0xFF0E5A78), glow * .6f) else baseFill
val edge = if (glow > 0f) androidx.compose.ui.graphics.lerp(baseEdge, Color(0xFF7FF3FF), glow * .6f) else baseEdge
val halo = edge.copy(alpha = if (cable != null) .28f else 0f)
val line = cell * .09f; val inset = cell * .08f
for (y in 0 until maze.height) for (x in 0 until maze.width) {
if (!maze.wallAt(x, y)) continue
val l = origin.x + x * cell; val t = origin.y + y * cell
drawRect(fill, Offset(l, t), Size(cell + .5f, cell + .5f))
if (y > 0 && !maze.wallAt(x, y - 1)) drawLine(edge, Offset(l, t + inset), Offset(l + cell, t + inset), line)
if (y < maze.height - 1 && !maze.wallAt(x, y + 1)) drawLine(edge, Offset(l, t + cell - inset), Offset(l + cell, t + cell - inset), line)
if (x > 0 && !maze.wallAt(x - 1, y)) drawLine(edge, Offset(l + inset, t), Offset(l + inset, t + cell), line)
if (x < maze.width - 1 && !maze.wallAt(x + 1, y)) drawLine(edge, Offset(l + cell - inset, t), Offset(l + cell - inset, t + cell), line)
for (pass in 0..1) {
if (pass == 0 && cable == null) continue
val c = if (pass == 0) halo else edge; val wdt = if (pass == 0) line * 3f else line
if (y > 0 && !maze.wallAt(x, y - 1)) drawLine(c, Offset(l, t + inset), Offset(l + cell, t + inset), wdt)
if (y < maze.height - 1 && !maze.wallAt(x, y + 1)) drawLine(c, Offset(l, t + cell - inset), Offset(l + cell, t + cell - inset), wdt)
if (x > 0 && !maze.wallAt(x - 1, y)) drawLine(c, Offset(l + inset, t), Offset(l + inset, t + cell), wdt)
if (x < maze.width - 1 && !maze.wallAt(x + 1, y)) drawLine(c, Offset(l + cell - inset, t), Offset(l + cell - inset, t + cell), wdt)
}
}
// The remote, waiting to be grabbed: a little Orbit remote, its buttons in the next channel's colour.
game.remote?.let { r ->
val c = centre(r); val k = if (steady) 1f else 1f + .08f * sin(timeMs / 200.0).toFloat()
val w = cell * .36f * k; val h = cell * .72f * k
val nextColour = SignalChannels[(game.channel + 1) % SignalChannels.size].second
drawCircle(nextColour.copy(alpha = .22f), cell * .55f * k, c)
drawRoundRect(Color(0xFF1B2A4E), Offset(c.x - w / 2, c.y - h / 2), Size(w, h), androidx.compose.ui.geometry.CornerRadius(w * .4f))
drawCircle(nextColour, w * .28f, Offset(c.x, c.y - h * .18f))
drawCircle(Color(0xFFFF6B6B), w * .1f, Offset(c.x, c.y - h * .38f))
drawCircle(Color.White.copy(alpha = .7f), w * .1f, Offset(c.x - w * .18f, c.y + h * .18f)); drawCircle(Color.White.copy(alpha = .7f), w * .1f, Offset(c.x + w * .18f, c.y + h * .18f))
}
drawLine(Color(0xFFFF9BD0), centre(maze.doorCell) - Offset(cell * .45f, 0f), centre(maze.doorCell) + Offset(cell * .45f, 0f), cell * .12f)
for (s in game.stars) { val c = centre(s); drawCircle(OrbStar.copy(alpha = .22f), cell * .24f, c); drawCircle(OrbStar, cell * .14f, c) }
@@ -473,7 +595,7 @@ private class OrbSounds {
}
private val tracks = runCatching {
mapOf("starA" to tone(45, 620.0, 660.0, .12), "starB" to tone(45, 780.0, 820.0, .12), OrbEvent.Power.name to tone(380, 280.0, 900.0, .22),
OrbEvent.Catch.name to tone(260, 500.0, 1200.0, .22), OrbEvent.Caught.name to tone(900, 720.0, 140.0, .22), OrbEvent.Cleared.name to tone(600, 520.0, 1040.0, .2))
OrbEvent.Catch.name to tone(260, 500.0, 1200.0, .22), OrbEvent.Caught.name to tone(900, 720.0, 140.0, .22), OrbEvent.Cleared.name to tone(600, 520.0, 1040.0, .2), OrbEvent.Switch.name to tone(320, 900.0, 300.0, .2))
}.getOrDefault(emptyMap())
private var flip = false
/** Plays [event] at [level] (the Arcade's effects level under Orbit's quiet ceiling); nothing at 0. */
@@ -502,14 +624,17 @@ internal fun OrbManScreen(play: ArcadePlay) {
var howTo by remember { mutableStateOf(false) }
var phase by remember { mutableFloatStateOf(0f) }
var clock by remember { mutableLongStateOf(0L) }
var bestBefore by remember { mutableIntStateOf(play.best) }
// Classic, or Signal Run (Phase 2): chosen on the title, remembered for this profile; each has its own High Scores.
var signal by remember { mutableStateOf(play.level["mode"] == "SignalRun") }
val table = if (signal) ORBMAN_SIGNAL_SCORES else gameDef.id
var bestBefore by remember { mutableIntStateOf(play.bestIn(table)) }
val focus = remember { FocusRequester() }
val backdrop = ArcadeLook.forGame(gameDef.id)
// Difficulty: Normal is the game as it always was; Gentle a fifth slower, Tricky a fifth quicker.
val tickMs = ORB_TICK_MS / classicPace(play.difficulty)
// Every run is saved when it ends, however it ends: game over, Leave, or the screen going away.
val run = rememberRun(play.onRunEnd) { RunEnd(game.score, finished = false, detail = "Level ${game.level}") }
fun startRun() { bestBefore = latestPlay.best; game = OrbGame.start(); run.begin(); paused = false; stage = ClassicStage.Play }
val run = rememberRun({ end -> if (game.signal) latestPlay.onRunEndIn(ORBMAN_SIGNAL_SCORES, end) else latestPlay.onRunEnd(end) }) { RunEnd(game.score, finished = false, detail = "Level ${game.level}") }
fun startRun() { bestBefore = latestPlay.bestIn(table); game = if (signal) OrbGame.signalStart() else OrbGame.start(); run.begin(); paused = false; stage = ClassicStage.Play }
fun leave() { run.end(RunEnd(game.score, finished = !game.alive, detail = "Level ${game.level}")); latestPlay.onLeave() }
PauseWhenHidden(stage == ClassicStage.Play && !paused) { paused = true }
// One frame clock: whole ticks move the game, what's left over places everyone smoothly in between.
@@ -534,9 +659,13 @@ internal fun OrbManScreen(play: ArcadePlay) {
BackHandler(stage == ClassicStage.Play && !paused) { paused = true }
if (stage == ClassicStage.Title) {
ClassicTitle(gameDef, backdrop, OrbCharacter.Blaze.colour, "Help me clear the stars!", listOf("Your best" to if (play.best > 0) "%,d".format(play.best) else "Not played yet"),
val best = play.bestIn(table)
ClassicTitle(gameDef, backdrop, OrbCharacter.Blaze.colour, if (signal) "Grab the remote: flip the channel!" else "Help me clear the stars!",
listOf("Your best" to if (best > 0) "%,d".format(best) else "Not played yet"),
timed = true, difficulty = play.difficulty, refocus = !howTo, onPlay = ::startRun, onHowTo = { howTo = true }, onBack = { latestPlay.onLeave() },
note = "Ollie keeps going on his own: press an arrow and he turns at the next gap.")
mode = if (signal) "Signal Run" else "Classic", modes = 2, onMode = { signal = !signal; latestPlay.setLevel("mode", if (signal) "SignalRun" else "Classic") },
note = if (signal) "Four channels, four mazes, quicker gliding. Grab the remote and the maze flips to the next channel: walls open and close, and the cast lose track of Ollie. Blaze charges when he sees you, Zip cuts ahead, Drift wanders, Luna guards the remote."
else "Ollie keeps going on his own: press an arrow and he turns at the next gap.")
if (howTo) HowToPlayCard(gameDef, firstRun = false, everyTime = null, onEveryTime = {}, onPlay = { howTo = false }, onBack = { howTo = false })
return
}
@@ -560,6 +689,8 @@ internal fun OrbManScreen(play: ArcadePlay) {
HudLabel("BEST"); HudValue("%,d".format(maxOf(bestBefore, game.score)))
Spacer(Modifier.height(6.dp))
HudLabel("LEVEL ${game.level}")
if (game.signal) { val (name, colour) = SignalChannels[game.channel]; HudLabel("ON $name".uppercase(), colour = colour) }
if (game.signal && game.lostLeft > 0) Text("The cast lost you!", color = ArcadeColours.Yellow, fontSize = 14.sp, fontWeight = FontWeight.SemiBold)
Canvas(Modifier.height(30.dp).fillMaxWidth()) { val r = size.height * .36f; for (k in 0 until game.lives) drawOrbMascot(Offset(r * 1.6f + k * r * 3.6f, size.height / 2), r) }
Spacer(Modifier.height(6.dp))
HudLabel("THE CAST")
@@ -576,11 +707,11 @@ internal fun OrbManScreen(play: ArcadePlay) {
Modifier.background(ArcadeColours.PanelDeep.copy(alpha = .9f), RoundedCornerShape(8.dp)).padding(horizontal = 16.dp, vertical = 6.dp), color = ArcadeColours.Yellow, fontFamily = Anton, fontSize = 26.sp)
}
}
if (stage == ClassicStage.Result) ClassicResult(gameDef, "STAR CHASE · LEVEL ${game.level} REACHED", "SCORE", "%,d".format(game.score),
newBest = game.score > bestBefore && game.score > 0, previous = previousLine(gameDef.scoreKind, bestBefore, gameDef.title),
detail = "${game.maze.cells('.').size + game.maze.cells('o').size - game.stars.size - game.powers.size} stars left on level ${game.level}".takeIf { game.stars.isNotEmpty() },
if (stage == ClassicStage.Result) ClassicResult(gameDef, (if (game.signal) "STAR CHASE · SIGNAL RUN · LEVEL ${game.level}" else "STAR CHASE · LEVEL ${game.level} REACHED"), "SCORE", "%,d".format(game.score),
newBest = game.score > bestBefore && game.score > 0, previous = previousLine(gameDef.scoreKind, bestBefore, if (game.signal) "Signal Run" else gameDef.title),
detail = if (game.signal) "${game.switches} channel switches" else null,
cheer = tv.orbit.classic.arcade.Mascot.Zip, onAgain = ::startRun, onBack = ::leave)
if (paused && stage == ClassicStage.Play) ArcadePauseMenu(gameDef, "Star Chase · Level ${game.level} · ${"%,d".format(game.score)}",
if (paused && stage == ClassicStage.Play) ArcadePauseMenu(gameDef, (if (game.signal) "Signal Run" else "Star Chase") + " · Level ${game.level} · ${"%,d".format(game.score)}",
onResume = { paused = false }, onRestart = { run.end(RunEnd(game.score, finished = false, detail = "Level ${game.level}")); startRun() }, onExit = ::leave,
sound = if (soundOn) "On" else "Off", onSound = { soundOn = !soundOn; latestPlay.setSetting("sound", soundOn) })
}
@@ -137,10 +137,11 @@ internal fun OrbitArcade(modifier: Modifier, onPlaying: (Boolean) -> Unit, onExi
writeLevel = { key, value -> update { d -> d.withGame(game.id) { it.copy(level = it.level + (key to value)) } } },
writeLevels = { values -> update { d -> d.withGame(game.id) { it.copy(level = it.level + values) } } },
onRunEnd = { end -> update { recordRun(it, game.id, game.scoreKind, end, System.currentTimeMillis()) } },
onRunEndIn = { table, end -> if (table in scoreTables(game.id)) update { recordRun(it, table, game.scoreKind, end, System.currentTimeMillis()) } },
onRunEndIn = { table, end -> if (table in scoreTables(game.id)) update { recordRun(it, table, tableKind(game.id, table, game.scoreKind), end, System.currentTimeMillis()) } },
onLeave = { session = SessionState.Exited; playing = null },
difficulty = difficultyFor(data, profile.kind), autoFire = autoFireFor(data), reduceFlashing = reduceFlashingFor(data),
kept = record.kept, writeKept = { values -> update { d -> d.withGame(game.id) { it.copy(kept = it.kept + values) } } })
kept = record.kept, writeKept = { values -> update { d -> d.withGame(game.id) { it.copy(kept = it.kept + values) } } },
bests = scoreTableDefs(game.id, game.scoreKind).associate { t -> t.id to bestOf(data.game(t.id), t.kind) })
key(game.id) { game.Content(play) }
return
}
@@ -40,8 +40,8 @@ private fun PageTitle(title: String, line: String) {
@Composable
internal fun HighScoresPage(profile: Profile, visible: List<ArcadeGame>, data: ArcadeProfileData, household: Map<String, HouseholdRecord>) {
var topTen by remember { mutableStateOf<ArcadeGame?>(null) }
// BumbleHive's row shows Normal's table or Hard's, switched with ◀▶ (Hard has its own High Scores).
var hiveHard by remember { mutableStateOf(false) }
// A game with modes (BumbleHive Hard, Star Chase Signal Run…) shows one table at a time, switched with ◀▶ on its row.
var tableIx by remember { mutableStateOf(emptyMap<String, Int>()) }
val now = remember { System.currentTimeMillis() }
PageTitle("HIGH SCORES", "${profile.name}, on this TV")
Row(Modifier.fillMaxSize(), horizontalArrangement = Arrangement.spacedBy(10.dp)) {
@@ -51,9 +51,10 @@ internal fun HighScoresPage(profile: Profile, visible: List<ArcadeGame>, data: A
listOf("Your best" to 90, "2nd" to 64, "3rd" to 64, "Played" to 64).forEach { (t, w) -> Text(t, Modifier.width(w.dp), color = ArcadeColours.Muted, fontSize = 12.sp, maxLines = 1) }
}
visible.forEach { g ->
val table = scoreTable(g, hiveHard)
ScoreRow(g, data.game(table), now, tableLabel = scoreTableLabel(g, hiveHard),
onSide = if (scoreTables(g.id).size > 1) { _ -> hiveHard = !hiveHard } else null) { topTen = g }
val defs = scoreTableDefs(g.id, g.scoreKind)
val ix = tableIx[g.id] ?: 0
ScoreRow(g, defs[ix], data.game(defs[ix].id), now, tableLabel = scoreTableLabel(g, ix), highlighted = ix > 0,
onSide = if (defs.size > 1) { side -> tableIx = tableIx + (g.id to Math.floorMod(ix + side, defs.size)) } else null) { topTen = g }
}
}
Column(Modifier.width(150.dp).fillMaxHeight().background(ArcadeColours.PanelDeep.copy(alpha = .85f), RoundedCornerShape(10.dp)).border(1.dp, ArcadeColours.Line, RoundedCornerShape(10.dp)).padding(8.dp)) {
@@ -62,25 +63,36 @@ internal fun HighScoresPage(profile: Profile, visible: List<ArcadeGame>, data: A
visible.forEach { g -> Text(householdLine(g, household) ?: "—", Modifier.fillMaxWidth().height(rowHeight).padding(top = 3.dp), color = ArcadeColours.Ink, fontSize = 13.sp, fontWeight = FontWeight.SemiBold, textAlign = androidx.compose.ui.text.style.TextAlign.End) }
}
}
topTen?.let { g -> TopTen(g, data.game(scoreTable(g, hiveHard)), now, title = scoreTableTitle(g, hiveHard), onClose = { topTen = null }) }
topTen?.let { g -> val ix = tableIx[g.id] ?: 0; val def = scoreTableDefs(g.id, g.scoreKind)[ix]; TopTen(g, def, data.game(def.id), now, title = scoreTableTitle(g, ix), onClose = { topTen = null }) }
}
/** Which High Scores table a game's row shows: BumbleHive Hard's when chosen, otherwise the game's own. */
internal fun scoreTable(game: ArcadeGame, hard: Boolean): String = if (hard && scoreTables(game.id).size > 1) HIVE_HARD_SCORES else game.id
/** Which High Scores table a game's row shows: its [ix]th (0 is the game's own). */
internal fun scoreTable(game: ArcadeGame, ix: Int): String = scoreTables(game.id).let { it[ix.coerceIn(0, it.size - 1)] }
internal fun scoreTable(game: ArcadeGame, hard: Boolean): String = scoreTable(game, if (hard) 1 else 0)
/** The switch on BumbleHive's row, so it's always clear which table is showing; null for games with one table. */
internal fun scoreTableLabel(game: ArcadeGame, hard: Boolean): String? = if (scoreTables(game.id).size > 1) (if (hard) "◀ HARD ▶" else "◀ Normal ▶") else null
/** The switch on a row with more than one table, so it's always clear which is showing; null for games with one table. */
internal fun scoreTableLabel(game: ArcadeGame, ix: Int): String? {
val defs = scoreTableDefs(game.id, game.scoreKind)
if (defs.size < 2) return null
val d = defs[ix.coerceIn(0, defs.size - 1)]
return if (ix == 0) "◀ ${d.name} ▶" else "◀ ${d.name.uppercase()} ▶"
}
internal fun scoreTableLabel(game: ArcadeGame, hard: Boolean): String? = scoreTableLabel(game, if (hard) 1 else 0)
/** The Top 10's heading. */
internal fun scoreTableTitle(game: ArcadeGame, hard: Boolean): String = game.title.uppercase() + (if (scoreTables(game.id).size > 1 && hard) " HARD" else "") + " · TOP 10"
internal fun scoreTableTitle(game: ArcadeGame, ix: Int): String {
val defs = scoreTableDefs(game.id, game.scoreKind)
return game.title.uppercase() + (if (ix > 0 && defs.size > 1) " " + defs[ix.coerceIn(0, defs.size - 1)].name.uppercase() else "") + " · TOP 10"
}
internal fun scoreTableTitle(game: ArcadeGame, hard: Boolean): String = scoreTableTitle(game, if (hard) 1 else 0)
private val rowHeight = 22.dp
@Composable
private fun ScoreRow(game: ArcadeGame, record: GameRecord, now: Long, tableLabel: String? = null, onSide: ((Int) -> Unit)? = null, onOpen: () -> Unit) {
private fun ScoreRow(game: ArcadeGame, table: ScoreTable, record: GameRecord, now: Long, tableLabel: String? = null, highlighted: Boolean = false, onSide: ((Int) -> Unit)? = null, onOpen: () -> Unit) {
var focused by remember { mutableStateOf(false) }
val corner = RoundedCornerShape(6.dp)
val runs = rankRuns(record.runs, game.scoreKind)
val runs = rankRuns(record.runs, table.kind)
Row(Modifier.fillMaxWidth().height(rowHeight).onFocusChanged { focused = it.isFocused }.background(if (focused) ArcadeColours.FocusFill else ArcadeColours.Panel.copy(alpha = .35f), corner)
.border(if (focused) 2.dp else 0.dp, if (focused) ArcadeColours.Yellow else ArcadeColours.Panel, corner).then(if (onSide != null) Modifier.onPreviewKeyEvent { e ->
val k = e.nativeKeyEvent
@@ -93,25 +105,24 @@ private fun ScoreRow(game: ArcadeGame, record: GameRecord, now: Long, tableLabel
Spacer(Modifier.width(6.dp))
Text(game.title, Modifier.weight(1f, fill = tableLabel == null), color = ArcadeColours.Ink, fontSize = 13.sp, maxLines = 1, overflow = TextOverflow.Ellipsis)
if (tableLabel != null) {
val hard = tableLabel.contains("HARD")
Text(tableLabel, Modifier.padding(start = 6.dp).background(if (hard) ArcadeColours.Pink else ArcadeColours.Panel, RoundedCornerShape(8.dp)).padding(horizontal = 6.dp),
Text(tableLabel, Modifier.padding(start = 6.dp).background(if (highlighted) ArcadeColours.Pink else ArcadeColours.Panel, RoundedCornerShape(8.dp)).padding(horizontal = 6.dp),
color = ArcadeColours.Ink, fontSize = 11.sp, fontWeight = FontWeight.Bold, maxLines = 1)
Spacer(Modifier.weight(1f))
}
val best = bestLine(game, record)
val best = bestOf(record, table.kind).takeIf { it > 0 }?.let(table.format)
if (best == null) Text(if (game.launchable) "Not played yet" else "Coming soon", Modifier.width(282.dp), color = ArcadeColours.Muted, fontSize = 12.sp)
else {
Text(best, Modifier.width(90.dp), color = ArcadeColours.Ink, fontSize = 13.sp, fontWeight = FontWeight.Bold, maxLines = 1)
val ranked = game.scoreKind == ScoreKind.Points || game.scoreKind == ScoreKind.FewestMoves
Text(if (ranked) runs.getOrNull(1)?.let { formatScore(game.scoreKind, it.score) }.orEmpty() else "", Modifier.width(64.dp), color = ArcadeColours.Muted, fontSize = 12.sp, maxLines = 1)
Text(if (ranked) runs.getOrNull(2)?.let { formatScore(game.scoreKind, it.score) }.orEmpty() else "", Modifier.width(64.dp), color = ArcadeColours.Muted, fontSize = 12.sp, maxLines = 1)
val ranked = table.kind == ScoreKind.Points || table.kind == ScoreKind.FewestMoves
Text(if (ranked) runs.getOrNull(1)?.let { table.format(it.score) }.orEmpty() else "", Modifier.width(64.dp), color = ArcadeColours.Muted, fontSize = 12.sp, maxLines = 1)
Text(if (ranked) runs.getOrNull(2)?.let { table.format(it.score) }.orEmpty() else "", Modifier.width(64.dp), color = ArcadeColours.Muted, fontSize = 12.sp, maxLines = 1)
Text(playedLabel(record.lastPlayedMs, now), Modifier.width(64.dp), color = ArcadeColours.Muted, fontSize = 12.sp, maxLines = 1)
}
}
}
@Composable
private fun TopTen(game: ArcadeGame, record: GameRecord, now: Long, title: String = "${game.title.uppercase()} · TOP 10", onClose: () -> Unit) {
private fun TopTen(game: ArcadeGame, table: ScoreTable, record: GameRecord, now: Long, title: String = "${game.title.uppercase()} · TOP 10", onClose: () -> Unit) {
val close = remember { FocusRequester() }
LaunchedEffect(Unit) { runCatching { close.requestFocus() } }
BackHandler(onBack = onClose)
@@ -119,13 +130,13 @@ private fun TopTen(game: ArcadeGame, record: GameRecord, now: Long, title: Strin
Column(Modifier.width(320.dp).background(ArcadeColours.PanelDeep, RoundedCornerShape(12.dp)).border(1.dp, ArcadeColours.Line, RoundedCornerShape(12.dp)).padding(16.dp),
verticalArrangement = Arrangement.spacedBy(4.dp)) {
Text(title, color = ArcadeColours.Ink, fontFamily = Anton, fontSize = 22.sp)
if (game.scoreKind == ScoreKind.Wins || game.scoreKind == ScoreKind.Solved) Text(formatScore(game.scoreKind, record.count) + " in all", color = ArcadeColours.Yellow, fontSize = 14.sp, fontWeight = FontWeight.SemiBold)
val runs = rankRuns(record.runs, game.scoreKind)
if (table.kind == ScoreKind.Wins || table.kind == ScoreKind.Solved) Text(formatScore(table.kind, record.count) + " in all", color = ArcadeColours.Yellow, fontSize = 14.sp, fontWeight = FontWeight.SemiBold)
val runs = rankRuns(record.runs, table.kind)
if (runs.isEmpty()) Text("Nothing saved yet.", color = ArcadeColours.Muted, fontSize = 13.sp)
runs.forEachIndexed { i, r ->
Row(Modifier.fillMaxWidth()) {
Text("${i + 1}.", Modifier.width(26.dp), color = ArcadeColours.Muted, fontSize = 13.sp)
Text(when (game.scoreKind) { ScoreKind.Wins -> "${r.score} moves"; ScoreKind.Solved -> "${r.score} hearts left"; else -> formatScore(game.scoreKind, r.score) },
Text(when { table.id != game.id -> table.format(r.score); table.kind == ScoreKind.Wins -> "${r.score} moves"; table.kind == ScoreKind.Solved -> "${r.score} hearts left"; else -> table.format(r.score) },
Modifier.weight(1f), color = ArcadeColours.Ink, fontSize = 13.sp, fontWeight = FontWeight.SemiBold)
Text(listOfNotNull(r.detail, playedLabel(r.atMs, now)).joinToString(" · "), color = ArcadeColours.Muted, fontSize = 12.sp)
}
@@ -36,7 +36,12 @@ internal class ArcadePlay(
private val writeLevels: (Map<String, String>) -> Unit = { m -> m.forEach { (k, v) -> writeLevel(k, v) } },
/** Saves a run into another of the game's High Scores tables ([scoreTables]): BumbleHive Hard's. */
val onRunEndIn: (String, RunEnd) -> Unit = { _, end -> onRunEnd(end) },
/** The best in each of the game's High Scores tables, by table id ([scoreTables]), for a mode's title and result. */
val bests: Map<String, Int> = emptyMap(),
) {
/** The best in [table], or the game's own best. */
fun bestIn(table: String) = bests[table] ?: best
fun setting(key: String) = readSetting(key)
fun setSetting(key: String, on: Boolean) = writeSetting(key, on)
fun setLevel(key: String, value: String) = writeLevel(key, value)
@@ -93,8 +93,30 @@ internal fun markPlayed(data: ArcadeProfileData, gameId: String, nowMs: Long): A
*/
internal const val HIVE_HARD_SCORES = "HiveHard"
/** The High Scores tables a game keeps: BumbleHive has Normal's and Hard's; every other game has one. */
internal fun scoreTables(gameId: String): List<String> = if (gameId == "Hive") listOf("Hive", HIVE_HARD_SCORES) else listOf(gameId)
/** Star Chase's Signal Run (Phase 2, 9 November 2026): its own High Scores, apart from Classic's. */
internal const val ORBMAN_SIGNAL_SCORES = "OrbManSignal"
/**
* One of a game's High Scores tables: the game's own (its id, its score kind), or a mode's, kept under its own record id so
* the two never mix (Paul: "preserve existing scores and make new modes separate"). [format] writes a score for the page.
*/
internal class ScoreTable(val id: String, val name: String, val kind: ScoreKind, val format: (Int) -> String = { formatScore(kind, it) })
/** The tables each game keeps beyond its own, in the order its High Scores row steps through them. */
internal val modeTables: Map<String, List<ScoreTable>> = mapOf(
"Hive" to listOf(ScoreTable(HIVE_HARD_SCORES, "Hard", ScoreKind.Points)),
"OrbMan" to listOf(ScoreTable(ORBMAN_SIGNAL_SCORES, "Signal Run", ScoreKind.Points)),
)
/** Every table of a game, its own first (called Normal for BumbleHive, Classic for the rest). */
internal fun scoreTableDefs(gameId: String, ownKind: ScoreKind): List<ScoreTable> =
listOf(ScoreTable(gameId, if (gameId == "Hive") "Normal" else "Classic", ownKind)) + modeTables[gameId].orEmpty()
/** The High Scores tables a game keeps: BumbleHive has Normal's and Hard's, Star Chase Classic's and Signal Run's, and so on. */
internal fun scoreTables(gameId: String): List<String> = listOf(gameId) + modeTables[gameId].orEmpty().map { it.id }
/** The score kind a table keeps: a mode's own, or the game's. */
internal fun tableKind(gameId: String, tableId: String, ownKind: ScoreKind): ScoreKind = modeTables[gameId]?.firstOrNull { it.id == tableId }?.kind ?: ownKind
/** The four things the Reset screen can do, each confirmed on its own. */
internal enum class ResetAction(val title: String) {
@@ -94,4 +94,74 @@ class OrbManTest {
}
assertTrue(maze.walls.count { it } == maze.rows.sumOf { r -> r.count { it == '#' } })
}
// ---------- Signal Run ----------
@Test fun signalRunsFourMazesAreWholeAndShareTheDenStartAndTunnel() {
assertEquals(4, SignalMazes.size)
for (m in SignalMazes) {
assertEquals(maze.width, m.width); assertEquals(maze.height, m.height)
assertEquals(maze.start, m.start); assertEquals(maze.doorCell, m.doorCell); assertEquals(maze.denCells, m.denCells)
assertTrue(m.open(OrbPos(0, 6)))
assertTrue(m.cells('R').isNotEmpty()); assertEquals(4, m.cells('o').size)
val seen = mutableSetOf(m.start); val queue = ArrayDeque(listOf(m.start))
while (queue.isNotEmpty()) { val p = queue.removeFirst(); for (d in OrbDir.entries) { val n = m.step(p, d); if (m.open(n) && seen.add(n)) queue += n } }
assertTrue((m.cells('.') + m.cells('o') + m.cells('R')).all { it in seen }); assertTrue(m.outside in seen)
for (y in 0 until m.height) for (x in 0 until m.width) {
val p = OrbPos(x, y)
val around = OrbDir.entries.map { OrbPos(x + it.dx, y + it.dy) }.filter { it.x in 0 until m.width && it.y in 0 until m.height }
if (m.wall(p)) assertTrue("lone wall at $p", around.any { m.wall(it) })
else if (m.open(p)) assertTrue("dead end at $p", OrbDir.entries.count { d -> m.open(m.step(p, d)) } >= 2)
}
}
// The four really are different mazes.
assertEquals(4, SignalMazes.map { it.rows }.toSet().size)
}
@Test fun signalRunGlidesAThirdQuickerAndClassicIsUnchanged() {
val classic = OrbGame.start(maze); val signal = OrbGame.signalStart()
assertEquals(8, classic.playerEvery); assertEquals(10, classic.chaserEvery)
assertEquals(6, signal.playerEvery); assertTrue(signal.chaserEvery < classic.chaserEvery)
assertFalse(classic.signal); assertNull(classic.remote)
assertTrue(signal.signal); assertNotNull(signal.remote)
}
@Test fun grabbingTheRemoteFlipsTheMazeKeepsTheStarsAndLosesTheCast() {
val g0 = OrbGame.signalStart().copy(readyLeft = 0)
val r = g0.remote!!
val beside = OrbDir.entries.map { g0.maze.step(r, it) }.first { g0.maze.open(it) }
val towards = OrbDir.entries.first { g0.maze.step(beside, it) == r }
var g = g0.copy(player = OrbMover(beside, beside, towards, 0), wanted = towards)
g = play(g, g.playerEvery)
assertTrue(OrbEvent.Switch in g.events)
assertEquals(1, g.channel); assertSame(SignalMazes[1], g.maze)
assertNull(g.remote); assertTrue(g.lostLeft > 0); assertEquals(1, g.switches)
// Every star is still there (none lost), each on an open square of the new maze.
assertEquals(g0.stars.size, g.stars.size); assertTrue(g.stars.all { g.maze.open(it) })
assertEquals(g0.powers.size, g.powers.size); assertTrue(g.powers.all { g.maze.open(it) })
assertTrue(g.maze.open(g.player.pos)); assertTrue(g.chasers.filter { it.out }.all { g.maze.open(it.mover.pos) })
// The remote comes back after a while, and switching four times goes round all four channels.
assertEquals(REMOTE_BACK_TICKS - 1, g.remoteIn) // the tick of the switch counts
val back = g.copy(remoteIn = 1).step(random)
assertEquals(back.remoteSpot(), back.remote)
var s = g0
repeat(4) { s = s.switched() }
assertEquals(0, s.channel)
}
@Test fun blazeChargesWhenHeSeesOllieInSignalRun() {
val g = OrbGame.signalStart().copy(readyLeft = 0)
val p = g.player.pos
// Along the open bottom row from the start, Blaze sees Ollie.
assertTrue(g.inSight(OrbPos(p.x - 3, p.y)))
assertFalse(g.inSight(OrbPos(p.x - 3, p.y - 3)))
}
@Test fun clearingASignalRunLevelCarriesTheChannelOn() {
val g = OrbGame.signalStart().switched().copy(readyLeft = 0)
val star = OrbPos(g.maze.start.x - 1, g.maze.start.y)
val at = OrbMover(g.maze.start, g.maze.start, OrbDir.Left, 0)
val next = play(g.copy(player = at, wanted = OrbDir.Left, stars = setOf(star), powers = emptySet()), g.playerEvery)
assertEquals(2, next.level); assertTrue(next.signal); assertEquals(1, next.channel)
}
}
@@ -0,0 +1,23 @@
package tv.orbit.classic.arcade
import org.junit.Assert.*
import org.junit.Test
/** Each new mode keeps its own High Scores (Paul: "preserve existing scores and make new modes separate"). */
class ModeTablesTest {
@Test fun starChaseKeepsClassicAndSignalRunApart() {
val g = ArcadeGames.OrbMan
assertEquals(listOf("OrbMan", ORBMAN_SIGNAL_SCORES), scoreTables("OrbMan"))
assertEquals("◀ Classic ▶", scoreTableLabel(g, 0)); assertEquals("◀ SIGNAL RUN ▶", scoreTableLabel(g, 1))
assertEquals("STAR CHASE SIGNAL RUN · TOP 10", scoreTableTitle(g, 1)); assertEquals("STAR CHASE · TOP 10", scoreTableTitle(g, 0))
var d = ArcadeProfileData(profileId = "p1")
d = recordRun(d, ORBMAN_SIGNAL_SCORES, tableKind("OrbMan", ORBMAN_SIGNAL_SCORES, g.scoreKind), RunEnd(5000, true, "Level 3"), 1)
assertTrue(d.game("OrbMan").runs.isEmpty()); assertEquals(5000, bestOf(d.game(ORBMAN_SIGNAL_SCORES), ScoreKind.Points))
// Classic's table, its Household key and its kind are as they were.
assertEquals("orb_man_best", g.legacyRecordKey); assertEquals(ScoreKind.Points, g.scoreKind)
// Clearing Star Chase's high scores clears both of its tables.
val cleared = applyReset(recordRun(d, "OrbMan", ScoreKind.Points, RunEnd(10, true), 2), "OrbMan", ResetAction.ClearHighScores, 3)
assertTrue(cleared.game("OrbMan").runs.isEmpty()); assertTrue(cleared.game(ORBMAN_SIGNAL_SCORES).runs.isEmpty())
assertNull(ArcadeGames.byId(ORBMAN_SIGNAL_SCORES))
}
}
@@ -86,4 +86,14 @@ class TitleTextFitsTest {
// And the whole result row fits the screen: the cast either side.
assertTrue(100 + 16 + 600 + 16 + 100 <= 960)
}
@Test fun theModeButtonSpellsEachModeOutInFull() {
// "◆ Mode" on the left, the mode's whole name on the right (12 sp detail), in the title's 210 dp column.
val label = Font(Font.SANS_SERIF, Font.BOLD, 1).deriveFont(14f * 1.3f)
val detail = Font(Font.SANS_SERIF, Font.PLAIN, 1).deriveFont(12f * 1.3f)
for (mode in listOf("Classic", "Signal Run")) {
val w = width(label, "◆ Mode") + 8 + width(detail, mode)
assertTrue("Mode · $mode is ${"%.0f".format(w)} dp", w <= 210 - 2 * 12 - 4)
}
}
}
@@ -69,8 +69,8 @@ class HiveScoresTest {
assertEquals("Hive", scoreTable(hive, hard = false)); assertEquals(HIVE_HARD_SCORES, scoreTable(hive, hard = true))
assertEquals("◀ Normal ▶", scoreTableLabel(hive, false)); assertEquals("◀ HARD ▶", scoreTableLabel(hive, true))
assertEquals("BUMBLEHIVE HARD · TOP 10", scoreTableTitle(hive, true)); assertEquals("BUMBLEHIVE · TOP 10", scoreTableTitle(hive, false))
// Every other game has one table and no switch.
for (g in ArcadeGames.all.filter { it.id != "Hive" }) {
// Games without modes have one table and no switch (the modes' tables are in ModeTablesTest).
for (g in ArcadeGames.all.filter { scoreTables(it.id).size == 1 }) {
assertEquals(listOf(g.id), scoreTables(g.id)); assertEquals(g.id, scoreTable(g, true)); assertNull(scoreTableLabel(g, true))
}
// Hard's table is not a game: no card, nothing for Kids filtering to show or hide on its own.
+35
View File
@@ -0,0 +1,35 @@
# The Classics' new modes (Phase 2, 9 November 2026)
Branch `classics-modes` from `classics-family`. Each new mode is separate, with its own High Scores table; the Classic
modes, their scores, the Household Records and Skydoku's 44 are untouched (Paul: "preserve existing scores and make new
modes separate"). A game's title has a **Mode** button that steps through Classic and its new modes, each spelled out in
full; the choice is remembered per profile.
## Mode tables
`ArcadeStore.kt`: `modeTables` lists each game's tables beyond its own (BumbleHive Hard was the first), with a name, a score
kind and how a score is written. The High Scores row steps through them with ◀▶ (◀ Classic ▶, ◀ SIGNAL RUN ▶ …), the Top 10
shows the table chosen, and Clear high scores clears all of a game's tables. Games are given each table's best
(`ArcadePlay.bestIn`) for their titles and results.
## Star Chase: Signal Run (0.112.0, versionCode 302)
- **Four mazes, one per channel**: Orbit 1 (cyan), Riot (pink), Terra (green), Tots (amber), drawn as glowing broadcast
cables in the channel's colour. All four share the den, its door, Ollie's start and the side tunnel; none has a wall on its
own or a dead end (checked by `OrbManTest`).
- **The Channel Switch**: a little remote waits in the maze (its buttons in the next channel's colour). Grab it (+100) and the
maze flips to the next channel's: walls open and close, the stars and hexagons stay where they are (any now inside a wall
moves to the nearest free corridor, none is lost), and the cast lose track of Ollie for 3 seconds, wandering. The remote is
back after 12 seconds, in another of its spots. A cleared level carries on in the channel you're on.
- **Quicker gliding**: Ollie moves a cell every 6 ticks (Classic 8), about a third quicker; the cast keep up. Turns are held
until there's room, as in Classic.
- **The cast hunt their own ways**: Blaze charges (quicker) when he can see Ollie straight down a corridor; Zip cuts in four
squares ahead; Drift wanders, turning at random two times in three; Luna guards the remote, or the stars nearest Ollie
while it's away.
- Points, in its own table `OrbManSignal`. Difficulty paces it like Classic; with Reduce motion or flashing the remote and
hexagons hold still and the cast don't blink.
- Classic plays exactly as before: every Signal Run rule is off unless the game is a Signal Run (the same random draws, the
same speeds; Classic's tests unchanged).
Checks: 1,003 unit tests run, 24 skipped, 0 failed; lint 0 errors, 87 warnings (none new); release APK 48,006,747 bytes
(+16,372 on 0.111.0); the Mode button's words fit at the largest font scale. Not installed; nothing seen running.