A common metaphor for a computer is that it’s a giant calculator. It’s easy to imagine a larger and larger machine. Pictures of a small desk calculator evolving into a slightly larger version, morphing into something the size of a breadbox with more buttons, changing into something the size of a refrigerator and finally we nod our heads and say “it’s a calculator but bigger”. That’s why it’s so powerful! It’s a huge calculator! But it’s not.

It’s a state machine.

What huge numbers would a calculator be unable to calculate anyway? You know that scientific notation 1.274921411340194917490141234 × 10^27? I’ve seen that in a calculator. Doesn’t that let the calculator handle a number of extremely large size? Is that why it can’t play games? Does a calculator not calculate enough? Or, is a state machine that is too slow to render real-time graphics.

It’s not that a calculator can’t store big numbers. It’s that a computer is so quick on changing its internal state that it can trick us with simulations and graphics.

A CPU is not a brain either but that’s a different post.

I encourage you to checkout the State Machine gem to play around with this concept. It has direct relevance to game development and other areas.