Appendix A
Function map
The load-bearing functions, grouped by subsystem. Every name links straight into the source.
Boot & the shared surface
HAS_DOM | assets/game/game.js:11 | The browser-vs-headless seam the whole file branches on. |
globalThis.TerrapinTrail | assets/game/game.js:3898 | The test/data surface handed out at the end of the IIFE. |
newGame | assets/game/game.js:1143 | Seed a fresh run from a role; roll the crew; clear any save. |
The game loop (a leg)
legNeeds | assets/game/game.js:1478 | Gas/grub the next leg will cost. |
driveOn | assets/game/game.js:1506 | Spend resources, queue events, start the drive. |
resumeLeg | assets/game/game.js:1604 | Resolve the leg on arrival, in strict order. |
checkDeath | assets/game/game.js:1633 | End the run if Vibes hit 0 or the crew is gone. |
Crew
resolveCrew | assets/game/game.js:1276 | Swap {archetype} tokens for the current crew name. |
crewHas | assets/game/game.js:1219 | Is this archetype aboard and alive? (gates perks & events). |
maybePoolCrew | assets/game/game.js:1382 | High-morale resource pooling on arrival. |
maybeRandyFind | assets/game/game.js:1409 | Randy's scavenge chance on arrival. |
Taping
startTaping | assets/game/game.js:1761 | Build the mini-game stages for the chosen spot. |
lockMini | assets/game/game.js:1811 | Grade one needle lock; track the combo. |
finishMini | assets/game/game.js:1838 | Turn average accuracy into tape quality. |
applyTapeOutcome | assets/game/game.js:1867 | Legendary/bust resolution and the show boost. |
Economy, buffs & the Peak
recomputeBuffs | assets/game/game.js:1123 | Rebuild s.buff and the shared CAP from installed parts. |
statCap | assets/game/game.js:1111 | The ceiling for a given stat. |
showPeak | assets/game/game.js:1640 | The once-per-run scripted stat surge. |
Scoring & endgame
computeScore | assets/game/game.js:2035 | The final score formula. |
endGame | assets/game/game.js:2061 | Persist the run, evaluate badges, show win/gameover. |
evaluateAchievements | assets/game/game.js:2192 | Check every badge against a run snapshot. |
Render & input
viewHtml | assets/game/game.js:2328 | Pure view -> HTML string map (the switch). |
render | assets/game/game.js:2363 | Paint and fire per-view side effects. |
handle | assets/game/game.js:3440 | The delegated action dispatcher. |
Persistence
serializeSave | assets/game/game.js:2214 | Snapshot the run minus transient keys. |
applySave | assets/game/game.js:2244 | Restore a save and re-derive CAP. |
Leaderboards in the game
loadHall | assets/game/game.js:2108 | The game's own Hall of the Fallen: this browser's saved runs. |
saveRun | assets/game/game.js:2119 | Keep a finished run in the local Hall. |
endGame | assets/game/game.js:2061 | Fires tt:runend so the play page can offer the shared board. |
The server (Python)
create_app | runner.py:172 | Every route: pages, archive browser API, boards, guide mount. |
api_score | runner.py:645 | Post a run to its tour-and-rules leaderboard. |
pick_daily | runner.py:497 | Tour of the Day: a band, the show nearest today, its tour. |
build_tour | archive.py:339 | One year's shows -> a playable tour with legendary and finale. |
list_bands | archive.py:411 | Every band collection on the Live Music Archive. |
show_tracks | archive.py:554 | A recording's playable songs and taper credits. |
resolve | geocode.py:166 | City text -> map position (state centre for small towns). |
Tags, rules and fair play
base_tags | tags.py:34 | #TTGD77Apr: a readable hashtag per tour. |
register | tags.py:66 | Claim a tag in the shared store so links resolve. |
encode | dna.py:72 | Slider positions -> the short rules code on the tag. |
decode | dna.py:89 | A rules code -> exact slider positions. |
check_run | trust.py:79 | Run ticket, speed and number checks on a score. |
clean_name | trust.py:43 | The public-board name filter. |
make_store | store.py:231 | Redis on Vercel, JSON files in the workspace. |