mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 00:14:00 +00:00
feat(server): complete phase 6 local verification
This commit is contained in:
@@ -24,3 +24,26 @@ const ARENAS := [
|
||||
static func random_path() -> String:
|
||||
var candidates := ARENAS.filter(func(arena): return arena["random"])
|
||||
return candidates[randi() % candidates.size()]["path"]
|
||||
|
||||
|
||||
# The arenas a server may rotate through, in declaration order. Same filter as
|
||||
# random_path(): an elevated-goal variant is Free-Play-only until a checkpoint
|
||||
# trained on it is promoted, and a dedicated server rotating onto one would
|
||||
# hand every bot-filled slot an arena it cannot score in.
|
||||
static func rotation_paths() -> Array:
|
||||
return ARENAS.filter(func(arena): return arena["random"]).map(func(arena): return arena["path"])
|
||||
|
||||
|
||||
# Task 6.5's arena rotation, as pure arithmetic so it is unit-testable without
|
||||
# a server: given how many matches have already been played, which arena is
|
||||
# next. `random` deliberately still uses the global RNG (the caller wants
|
||||
# variety, not reproducibility); `sequential` is a pure function of the count,
|
||||
# which is what makes "the server cycles arenas" an assertable claim rather
|
||||
# than an observation about luck.
|
||||
static func path_for_match(match_index: int, mode: String) -> String:
|
||||
var paths := rotation_paths()
|
||||
if paths.is_empty():
|
||||
return ARENAS[0]["path"]
|
||||
if mode == "random":
|
||||
return paths[randi() % paths.size()]
|
||||
return paths[posmod(match_index, paths.size())]
|
||||
|
||||
Reference in New Issue
Block a user