Star Trek: The Original Series, season 1, episode 23
A Taste of Armageddon
Summary
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. 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.
Summary from Wikipedia, CC BY-SA 4.0.
Find out more
These links open the services in a new tab with the question pre-filled; the AI assistants may ask you to sign in. Their answers can contain errors.