On the Subject of 4 Lights
Binary turns them off...
A: 4-digit binary number, left to right. (Lit = 1)
B: 4-digit binary number, bulb label 1 to label 4. (Lit = 1)
(e.g.) on4, off1, on2, on3: A = 10112 and B = 01112
Shorthands
- ind: indicators
- #: number of
- label: the button with label/number
IF (1st that apply): | THEN press |
---|---|
ALL bulbs on | label 1,2,3,4 |
ALL bulbs off | label 4,3,2,1 |
#Lit bulb = #lit ind AND #Unlit bulb = #unlit ind |
1) label (#lit) 2) label (#unlit) |
1 lit bulb | *label of lit position |
A = B |
1) button below of leftmost lit bulb 2) smallest label whose bulb is lit |
A ≥ 10 AND B ≥ 10 (in base 10) |
C = A AND B **Press: position where C is 1 (left to right) |
ELSE |
1) lit labels: ASC 2) Unlit labels: DESC |
* (e.g.) bulb at pos 3: press label 3
** A = 1101; B = 1011; then A AND B = 1001, pressing 1st then 4th in reading order.