The upshot of going from 1 on a 10 point scale to -1 on a 10 point scale was kind of like turning an analog clock back an hour from 1 o'clock. But it read 11111111 not as -1 aggressiveness but as 255 aggressiveness. So it read 00000001 as 1 aggressiveness as intended.
But Civ 1 then read aggressiveness stats as unsigned integers. When learning Democracy dropped his aggressiveness to -1, it represented that as 11111111. Thus it represented Gandhi's initial 1 aggressiveness as 00000001. Civ 1 essentially wrote down aggressiveness stats using signed integers. With signed integers, a 1 there instead is defined to mean NEGATIVE 128. That leftmost spot with unsigned integers is the "128s place" and a 1 there meant 128, just as you'd expect. BUT anything with a 1 in the leftmost spot is different. Everything between 0 and 127 works the same as with 8-bit unsigned integers. The 256 integers between -128 and +127 are represented instead. With 8-bit signed integers, it's different. So the 256 integers between 0 and 255 can be represented. With 8-bit unsigned integers, everything works as I said above. But with a computer's binary you can't actually do that, even with signed integers.
You're no doubt used to just putting a "-" sign in front of a number to mark it as negative. Now to return to signed vs unsigned integers. It will use all 8 digits and just leave a 0 in everything but the 1s place. This is exactly what you do when you look at 234 in base-10 and understand its value to be (2 x 100 = 200) + (3 x 10 = 30 ) + (4 x 1 = 4), but you probably don't need to actually think about that.Ī computer using 8-bit integers would represent 1 as 00000001. From right to left it has a 0 in the 1s place, a 1 in the 2s place, a 0 in the 4s place, a 1 in the 8s place, a 0 in the 16s place, a 1 in the 32s place, a 1 in the 64s place, and a 1 in the 128s place. To return to the example, here's how 234 would be represented in binary: 11101010.
Those are just the powers of 2: 2 ^ 0 is 1, 2 ^ 1 is 2, 2 ^ 2 is 4, etc. Well in base-2 numbers have a "1s place", a "2s place", a "4s place", an "8s place", etc. Those places correspond to the powers of 10: 10 ^ 0 is 1, 10 ^ 1 is 10, 10 ^ 2 is 100, and so on. For example, 234 has a 2 in the 100s place, a 3 in the 10s place, and a 4 in the 1s place. And in base-10 our numbers have a "1s place", a "10s place", a "100s place", and so on. In base-2, any digit in a number can be one of 2 things (0 or 1). In base-10 any digit in a number can be one of 10 things (0, 1, 2, 3, 4, 5, 6, 7, 8, or 9). As most of you likely know, binary means a base-2 counting system. I'll give a better explanation in a moment, but for now just know that an unsigned integer is one that can only be positive or 0, while a signed integer can be positive, 0, or negative.Īn 8-bit integer basically means one that has up to 8 digits in the binary numeral system. See, Civ 1 was setting aggressiveness stats using a signed 8-bit integer, but interpreting the aggressiveness stat as an unsigned 8-bit integer. Time for a bit of math and computer science! Skip the spoilered section if you'd rather have a metaphor. But the poorly debugged programs of mice and men go awry. When they got Democracy, the discovering Civ's aggressiveness would drop by 2, making them more peaceable for the rest of the game. One of them was that civ discovering Democracy. However, a few things modified the normally static aggressiveness stat. This meant Gandhi would basically never choose to go to war and would readily accept peace treaties. 1 was the minimum amount of aggressiveness, and Gandhi had it. This determined their likelihood to declare war or accept peace treaties under various circumstances. In Civilization 1, every AI civ leader had a hidden stat from 1 to 10 that rated their aggressiveness. There's a lot of documentation about the details of this in Civ 1 and Civ 5 but considerably less for the games in between. Would you be willing to go over civilization tendencies, such as what leads to Democratic Ghandi going nuclear, and how that affects your choice of civilization (or doesn't), as well as how the AI tends to act?