[comp.theory.cell-automata] Fast way to update grids

hiebeler@pawl19.pawl.rpi.edu (David E. Hiebeler) (01/27/88)

	I've been working on a project for some time now which reads in an
algorithm, and writes a C program to run some 2-D automata.  It's coming
along pretty well now, but now I'd like to get some input from people 'out
there.'
	Basically, I'm looking for a fast (the fastest?) way of updating
grids, where each cell has to look at an arbitrary number of its neighbors.
I've seen some fast life-programs, but often they took advantage of particular
quirks of the the rules of Life.
	I need some method more general.  I've tried the simple method,
storing the grid in an array, and simply using 2 indices to cover the grid,
and each cell stores its new value in a 2nd copy of the grid.  Say you have 5
neighbors, then each cell requires 5 things like "grid[x][y+1]" for example
to get the value of its south neighbor.
	I tried a field of linked nodes; i defined a whole bunch of structs,
and each cell had a value, plus the structure contained pointers to all of
its neighbors.  So the south neighbor might be (cell.south).value for example.
	Both methods ran at about the same speed (this was on a Sequent
Balance 21000, using C).
 
	Does anyone out there have some useful tips on what I can do to
speed up the program?  Any comments would be greatly appreciated...
  Thanks,
Dave Hiebeler    Internet: hiebeler@csv.rpi.edu (preferred address)
R.D. Box 225A              hiebeler@b21.cs.rpi.edu
Chatham, NY 12037          userfrzk%mts.rpi.edu@itsgw.rpi.edu
                 Bitnet:   userfrzk@rpitsmts.bitnet

----
David Hiebeler       hiebeler@csv.rpi.edu
Troy, NY            "Wo bu jidow wo tzai
                     shua shumua"