When we write a number, like 5326, we all believe that we know what we are talking about  but what, exactly, are we talking about? We don't mean 5 + 3 + 2 + 6 or 5 x 3 x 2 x 6. What we mean is (5 x 1000) + (3 x 100) + (2 x 10) + (6 x 1). Our system of numerals is a placevalue system. The 6 is in the one's place, the 2 is in the 10's place, and so on. Notice that (5 x 1000) + (3 x 100) + (2 x 10) + (6 x 1) = (5 x 10^{3}) + (3 x 10^{2}) + (2 x 10^{1}) + (6 x 10^{0}). We understand that the numeral in each place needs to be multiplied by 10^{place number}, where the place numbers start at zero.
It has been widely conjectured that our placevalue system is based on tens because people (usually) have ten fingers (and ten toes). What then, would our ancestors have done if they had sixteen fingers and sixteen toes? In that case, the number 5326 would likely mean (5 x 16^{3}) + (3 x 16^{2}) + (2 x 16^{1}) + (6 x 16^{0}). This is called a "base16" number. There is nothing "sacred" about using 10 as a base for numerals  base 16 works the same way. In fact, base16, or hexadecimal, numbers are often used in computer science, because they fit the situation morenaturally that base10 numbers.
Our common base10 number system uses ten digits, 09, because each of the "places" could have one of ten different values. In other bases, you have different numbers of digits  base16 requires 16 digits (They are 09, A = 10, B = 11, C = 12, D = 13, E = 14,F = 15.) base5 requires only 5 digits (04), base2 uses only 2 digits (0 and 1).
It turns out that base2 numbers are also particularly useful in computer science, because, for instance, a memory location (bit) can be either "on" (1) or "off" (0). So a useful shorthand for "on, off, off, on, off, on, on, on" is the binary number "10010111".
The base2 number "10010111" means (1 x 2^{7}) + (0 x 2^{6}) + (0 x 2^{5}) + (1 x 2^{4}) + (0 x 2^{3}) + (1 x 2^{2}) + (1 x 2^{1}) + (1 x 2^{0}) = (1 x 128) + (0 x 64) + (0 x 32) + (1 x 16) + (0 x 8) + (1 x 4) + (1 x 2) + (1 x 1) = 151 (in base10).
Binary numbers are very convenient for describing the rules for elementary cellular automata.Why bother? Let's examine a typical rule. First, in English:
(0)"If the current cell is 'off' and both of its neighbors are 'off', it becomes 'on' in the next generation, (2) but if the current cell and its neigbor to its (our) left is 'off' but the neighbor to its (our) right is 'on', the cell becomes 'on' in the next generation, (4) but if the current cell is 'on' but both neighbors are 'off', it stays on in the next generation,(8) but if the current cell and it's right neighbor are both 'on', but the left neighbor is 'off', it turns 'off', (16) but if the current cell and its right neighbor are both 'off'' and its left neighbor is 'on', it turns 'on', (32) but if the current cell is 'off' and both neighbors are 'on', it turns 'off', (64) but if the cell and its left neighbor are both 'on' and the right neighbor is 'off', it turns 'off', (128) but if the current cell and both its neighbors are 'on', it stays 'on'."
By any measure, this is not a good way to describe a rule. You gave up reading it before you were halfway through, didn't you?. Luckily, rules for elementary cellular automata can also be described graphically, as follows:
This is the same rule described in English above. The graphical form is very convenient when you are trying to construct the output of a rule, but it is not very handy for describing the CA, because it's not easy to tell two rules apart if they only differ by one or two "on"s and "off"s. However,, a rule can be summarized as an 8bit (place) base2 number, like this:
"10010111" = 151
It is very easy to talk about rules using this notation. You can just say "Rule 151". This is why CAs are often referred to by their code numbers.
You have seen some examples of converting base2 numbers into base10 numbers, but what is someone gives you a base10 rule number  how do you tell where the "on"s and "off"s go?
Suppose someone mentions the Rule 150 CA. What does that look like graphically? The conversion is easily done by repeated subtraction. The process is demonstrated in the table below.
Converting the Base10 Number 150 to Base2 

Step 
Result 
Start at the leftmost place  the 128's place. If you can subtract 128 from the number (and get a nonnegative result), do so (150  128 = 22) and put a "1" in this place. Otherwise, put a "0".  
Can you subtract 64 from 22? No. The 64's place digit is "0".  
Can you subtract 32 from 22? No. The 32's place digit is "0".  
Can you subtract 16 from 22? Yes, 22  16 = 6. The 16's place digit is "1".  
Can you subtract 8 from 6? No. The 8's digit is "0".  
Can you subtract 4 from 6? Yes, 6  4 = 2. The 4's place digit is "1".  
Can you subtract 2 from 2? Yes, 2  2 = 0. The 2's place digit is "1".  
Can you subtract 1 from 0? No. The 1's digit is "0". Actually, once you get a result of 0 you can fill in all of the remaining places with 0's. 

1's represent a black cell in the next generation, while 0's represent a white cell. Just fill in the rule and you are done! 
Therefore, rule 150 in binary form is "10010110".
Of course other number bases are possible, but are they useful? Well, yes. For instance, we will be branching out into CAs that can have three states per cell  it is easiest to specify their codes using base3 numbers. For instance, the rule "10220012" = (1 x 3^{7}) + (0 x 3^{6}) + (2 x 3^{5}) + (2 x 3^{4}) + (0 x 3^{3}) + (0 x 3^{2}) + (1 x 3^{1}) + (2 x 3^{0}) = (1 x 2187) + (0 x 729) + (2 x 243) + (2 x 81) + (0 x 27) + (0 x 9) + (1 x 3) + (2 x 1) = 2840 (in base10). There are a lot more possible rules using 3state cells!
last update November 23, 2009 by JL Stanbrough