Xref: utzoo comp.theory.cell-automata:1 comp.misc:1742 comp.theory:7 comp.lang.c:6786 Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!homxb!whuts!mtune!rutgers!sunybcs!bingvaxu!leah!itsgw!imagine!pawl19.pawl.rpi.edu!hiebeler From: hiebeler@pawl19.pawl.rpi.edu (David E. Hiebeler) Newsgroups: comp.theory.cell-automata,comp.misc,comp.theory,comp.lang.c Subject: Fast way to update grids Summary: This is for 2-D automata Message-ID: <255@imagine.PAWL.RPI.EDU> Date: 27 Jan 88 04:40:45 GMT Sender: news@imagine.PAWL.RPI.EDU Reply-To: hiebeler@csv.rpi.edu (Dave Hiebeler) Organization: RPI CS Dept., Cellular Automata Development Group Lines: 32 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"