April 6, 2012 It’s election year in the United States, and in
today’s exercise we have an election simulation. It comes to us
from chapter “Five Easy Pieces” in A. K. Dewdney’s book The
Armchair Universe, which is a compilation of some of Dewdney’s
“Computer Recreations” columns in Scientific American. Dewdney
calls his simulation voters. The simulation is simple. A
rectangular x-by-y grid contains cells that represent voters.
Each cell has eight horizontally, vertically or diagonally
adjacent neighbors, with the grid wrapping around on all sides
to form a torus. Each cell can contain one of two values, which
we call 0 and 1, not necessarily in order, instead of Democrat
or Republican. At each time step, one cell, chosen at random,
changes its allegiance to that of one of its eight neighbors,
chosen at random; in some cases that random choice leaves the
allegiance unchanged. The current state of the simulation is
displayed on the screen, with easily distinguishable symbols for
0 and 1. The simulation continue