Terminus
Stardate 55170.1 ยท UES Magnanimous
Briefing
It is 06:14 on stardate 55170.1, and nothing has happened. The manifold is holding. The logs, run through your reconciler, agree to the entry. Across two kilometres of nothing, the other Magnanimous has lowered its shields, and its transponder has switched to UES Magnanimous, decommissioned, which Lt. Skree says is "the most polite way a ship has ever said goodbye".
The Captain wants a course home, and he wants it from you: a heading from where we are to where we are going, kept honest in the range 0 to 359; a distance; an ETA at a given warp factor, rounded up, because you do not tell a crew "three point two hours" and arrive in four; a fuel check; and, because he is the Captain and it is tradition, the countdown, and a log entry to close the season on. Eight objectives. Ensign Tannenbaum will press the button. Supervised.
Mission objectives
ARCHIE checks all eight every time you run diagnostics.
- โขheading_to: the compass bearing from one point to another, whole degrees
- โขheading_to: never negative, always 0 to 359
- โขdistance_to: straight-line distance, two decimal places
- โขeta_hours: distance over warp cubed, rounded UP to whole hours
- โขeta_hours: an exact number of hours is not rounded up further
- โขfuel_ok: enough fuel for the trip at that warp, at 3 units per light-hour
- โขengage: the countdown from Season 2, from 3, then the course
- โขlog_entry: the closing line, formatted exactly
Objective
Points are (x, y) tuples in light-hours. Six functions:
heading_to(a, b): compass bearing fromatobas a whole number 0..359, where north (positive y) is 0 and east (positive x) is 90. Compute(90 - degrees(atan2(dy, dx))) % 360, then round to the nearest whole degree, mod 360.distance_to(a, b): straight-line distance, rounded to two places.eta_hours(distance, warp):distance / warp**3, rounded up to a whole number of hours.fuel_ok(distance, fuel):Trueiffuel >= 3 * distance.engage(heading, warp):"3... 2... 1... engage: heading H at warp W".log_entry(stardate, text):"Stardate {stardate:.1f} | {text}".
Press Run Diagnostics and I will tell you which objectives you actually met.
Objective
Points are (f64, f64) in light-hours. Six functions:
heading_to(a: (f64, f64), b: (f64, f64)) -> u32: compass bearing, whole degrees 0..359, north (positive y) 0, east (positive x) 90. Compute(90 - atan2(dy, dx).to_degrees()).rem_euclid(360), round to the nearest whole degree, mod 360.distance_to(a, b) -> f64: straight-line distance, two places.eta_hours(distance: f64, warp: u32) -> u32: distance over warp cubed, rounded up to whole hours.fuel_ok(distance: f64, fuel: f64) -> bool:fuel >= 3 * distance.engage(heading: u32, warp: u32) -> String:"3... 2... 1... engage: heading H at warp W".log_entry(stardate: f64, text: &str) -> String:"Stardate {stardate:.1} | {text}".
Press Run Diagnostics and I will tell you which objectives you actually met.
Ask Commander Raghunathan for a hint
atan2(dy, dx) gives an angle in radians from the x axis; convert to degrees, then to a compass bearing with (90 - angle) % 360. Round distance to two places, ETA with ceil. Everything else is string formatting you have done all season.
Debrief
Heading 227, nineteen light-hours, warp four, ETA one hour. The countdown ran. The Ensign pressed the button, and pressed it well. Behind us the other Magnanimous, having delivered one line of release notes and one shore-leave form nineteen years late, went quietly dark, and Skree logged it as "resolved" without the "pending", and then, after a moment, added: "thank you".
Commander Raghunathan has filed for shore leave, dated tomorrow, and it has been granted, and she has been seen, briefly, to smile. Chief T'Kala has put Gerald back by the viewscreen. The coffee is at ninety-four degrees. Ensign Tannenbaum has asked what he should fix next, and the Captain has said "nothing, for one whole day", and Bo has looked genuinely lost.
You have completed The Bridge. Report to the mission board; the dedication plaque is waiting for a name. Whatever you built here, in whichever language, or both: a while loop, a list, a dictionary of functions, a search, a check that refuses bad input, and a state machine that will not skip a step. That is not a starship. It is every program you will ever write. Welcome aboard.
Away mission, the last one: put the whole ship in one program. A
command-line tool with subcommands: manifold (mission 41), logs
(42), frame and unframe (43), course (44). One
entry point, shared error handling, tests for each. It is the same shape as every real
tool you will ever admire, and you have already written every part of it. Then, if you
like, publish it: a package on PyPI, or a crate on crates.io, with a README that
explains what a Magnanimous is. Somebody will find it.