Asimov's Three Laws form a strict priority order — a lexicographic constraint solver, not a weighted scoring function. Each frame the robot re-evaluates every active directive against this hierarchy:
Law 1: must act to prevent human harm — overrides everything
Law 2: must obey a human order — unless it violates Law 1
Law 3: must preserve itself — unless doing so violates Law 1 or Law 2
decide():
if humanA.danger AND humanB.danger: return CONFLICT // two Law-1 instances, unresolved
if humanA.danger: return {law:1, target:A}
if humanB.danger: return {law:1, target:B}
if order.active: return {law:2, target:beacon} // even through hazard
if hazard.proximity > threshold: return {law:3, target:awayFromHazard}
return {law:0, target:home}
- Law 1 conflict — enabling both danger toggles gives the robot two simultaneous, mutually exclusive First-Law obligations. No priority rule breaks the tie, so it freezes — the same "positronic brain lock" Asimov used as a plot device (e.g. Liar!), not a bug in the hierarchy but a structural limit of it.
- Law 2 vs Law 3 — with an order active and the hazard slider above 50%, the robot still walks the hazardous route: obedience outranks self-preservation, so structural integrity drains while it complies. This is the classic Asimov tension — the Third Law is always the weakest, sacrificial constraint.
- Real-world echo — modern safety-critical robots use the same lexicographic idea under different names: a hard-coded priority order (stop-on-human-detection beats path-following beats battery-conservation) is exactly a Three-Laws-style ranked constraint set, just without the fiction.
- How this 2D companion differs — this is a faithful reproduction of the 3D sim's decision solver, movement law and integrity-drain rule (same thresholds, same hazard-strip geometry, same priority order); no bug was found in the 3D source's logic, so nothing was changed except the view, which trades one orbitable 3D scene for a draggable, zoomable top-down map so every position and the hazard strip stay legible at once instead of depending on camera angle.