Star Trek The Original Series S01 E23 – A Taste of Armageddon

On Eminiar VII, the Enterprise finds a civilization at war with its planetary neighbor. Unable to discern any signs of battle from orbit, Captain Kirk leads a landing party to the surface where he discovers the entire war is fought by computer. Even though the war is simulated, citizens who are listed as virtual casualties still report to termination booths to be killed for real. After the Enterprise is destroyed in an attack simulation, Kirk must fight to keep his crew from death.