The Nuclear Gandhi Story. A computer bug and the stubborn power… | by Mike Beneschan | Medium


A programming error in the Civilization game series caused Mahatma Gandhi's in-game character to unexpectedly become a nuclear-armed aggressor.
AI Summary available — skim the key points instantly. Show AI Generated Summary
Show AI Generated Summary

The Nuclear Gandhi Story

Photo by Ishant Mishra on Unsplash

I’m going to tell you two stories, and it matters which order I tell them in. Here’s the first story.

Civilization is a 1991 strategy game where you watch Gandhi, Genghis Khan, Abraham Lincoln, and Napoleon Bonaparte wage war on each other with platoons of tanks, stealth bombers, and Renaissance-era chariots, all while you, Queen Elizabeth I, fend off barbarian tribes while also researching nuclear weaponry. At least, that was my experience of Civilization, and I loved it.

The Civilization games delicately balance depth and goofiness. This is a series with so much attention to detail, newer Civilization games have built-in encyclopedias. But this is also the series where a dinky Medieval spearman can take down a rocket artillery. And it’s the series where Mahatma Gandhi — peaceful, “I don’t believe anything good comes from war” Gandhi — will go hostile and nuke your entire empire to bits, due to the infamous “Nuclear Gandhi” bug.

Depending on who you talk to, the bug either started in Civilization (1991) or Civilization II (1996). But the explanation was nearly always the same.

Each computer-controlled leader had an “aggression score” from 1 to 10, which dictated how often they’d attack other nations. Genghis Khan or Napoleon Bonaparte would play aggressively and wage wars, but Gandhi would play peacefully. Gandhi had the lowest possible aggression score: 1.

But a leader’s aggression score could change. If a civilization switched its form of government to democracy, that would lower the aggression score by 2.

In Gandhi’s case this should lower his aggression score to -1. But the “aggression score” variable was stored as an unsigned integer (an integer that doesn’t include + or - signs), meaning it was impossible for the value to be saved as -1. It’s like how if you have a clock at 1:00, then rewind the clock 2 hours, the clock reads 11:00 instead of -1:00. Instead of saving Gandhi’s aggression score at -1, the game set Gandhi’s aggression level at the highest possible value for an 8-bit unsigned integer, 255. This phenomenon is called integer overflow.

Was this article displayed correctly? Not happy with what you see?

Tabs Reminder: Tabs piling up in your browser? Set a reminder for them, close them and get notified at the right time.

Try our Chrome extension today!


Share this article with your
friends and colleagues.
Earn points from views and
referrals who sign up.
Learn more

Facebook

Save articles to reading lists
and access them on any device


Share this article with your
friends and colleagues.
Earn points from views and
referrals who sign up.
Learn more

Facebook

Save articles to reading lists
and access them on any device