โš™๏ธ Engineering

The Manifold

Stardate 55168.0 ยท UES Magnanimous

Briefing

Commander Raghunathan has read the other ship's release notes for version 1.10.3 eleven times and has finally said it out loud: pressure|flow mismatch is the plasma manifold. It is the fault behind the incident nobody talks about, and it is scheduled, according to both logs, for tomorrow. The other Magnanimous did not have the fix in time. It has brought it back.

The fix is a validator. Flow through the manifold should track pressure: the expected flow is four times the square root of the pressure, and a reading whose flow is more than ten percent off that expectation is a mismatch. One mismatch is noise. Two are a warning. Three in a row is the incident, and the core must be told before it happens. This is three functions, eight objectives, and the reason the other ship came. Ensign Tannenbaum has asked to help and, for the first time, been told yes.

Mission objectives

ARCHIE checks all eight every time you run diagnostics.

  • โ€ขexpected_flow: four times the square root of pressure, to two places
  • โ€ขis_mismatch: a flow more than ten percent off expectation
  • โ€ขis_mismatch: exactly ten percent off is not a mismatch
  • โ€ขmismatches: the indices of every mismatched reading
  • โ€ขmismatches: no readings, no indices
  • โ€ขstatus: 'nominal' when nothing is wrong
  • โ€ขstatus: 'mismatch at N readings' otherwise
  • โ€ขstatus: 'critical' when three or more mismatches are consecutive
Ask Commander Raghunathan for a hint

Build the three functions on top of each other: status uses mismatches, which uses is_mismatch, which uses expected_flow. For 'consecutive', walk the indices and count a run; reset the run whenever the gap is more than one.

๐Ÿš€ Away mission

Away mission, for your own editor: turn the validator into a real program. Read readings from a CSV file, one pressure,flow per line, print the status, and exit with a non-zero code on critical so a shell script can react. Then add a --tolerance flag with a default of 10 percent. Nothing here is graded; it is the point at which a browser console should make you want a real one.