The Airlock Interlock
Stardate 55110.6 ยท UES Magnanimous
Briefing
An airlock's outer door may open only when the inner door is sealed and the pressure has been equalised and maintenance has not locked it out. Three conditions, all of which must hold. This is not a complicated rule. It is, however, currently written with an or in it.
Chief T'Kala discovered this during a routine check by watching the outer door cheerfully report itself "ready to open" while the inner door stood wide. She closed the inner door, sat down, and asked ARCHIE to route the fix to "someone who has read a sentence before". Lt. Skree has offered to explain what an "and" is. The offer has been declined.
Mission objectives
ARCHIE checks all five every time you run diagnostics.
- โขEverything in order: sealed, equalised, no lockout, so it may open
- โขInner door open: must not open
- โขPressure not equalised: must not open
- โขMaintenance lockout engaged: must not open, even though the rest is fine
- โขNothing in order at all: must not open
Objective
Write outer_may_open(inner_sealed, pressure_equalised, lockout), three
booleans. Return True only when the inner door is sealed and
pressure is equalised and there is no lockout.
Otherwise False.
Press Run Diagnostics and I will tell you which objectives you actually met.
Objective
Write outer_may_open(inner_sealed: bool, pressure_equalised: bool, lockout: bool)
-> bool. Return true only when the inner door is sealed
and pressure is equalised and there is
no lockout. Otherwise false.
Press Run Diagnostics and I will tell you which objectives you actually met.
Ask Commander Raghunathan for a hint
Three conditions joined with and, one of them negated. Read the fourth objective: the lockout is a reason to refuse, so it is not lockout (Python) or !lockout (Rust).
Debrief
The outer door now refuses to open unless all three conditions hold. Chief T'Kala has gone back to watering Gerald. Lt. Skree has written a short paper on the difference between conjunction and disjunction and left a copy on Ensign Tannenbaum's desk. It is eleven pages.