home *** CD-ROM | disk | FTP | other *** search
- /*
- * File: life.m2.c
- * By: Dave Hiebeler
- * hiebeler@turing.cs.rpi.edu
- * August 1989
- *
- * John Conway's "Life" rule....
- */
-
-
- #include "nborhood.h"
-
- byte life_rule();
-
- void
- init_function()
- {
- update_function = life_rule;
- }
-
-
- byte
- life_rule(nbors)
- moore_nbors *nbors;
- {
- int nborsum;
-
- Get_moore_nbors;
-
- nborsum = tl + l + bl + t + b + tr + r + br;
- switch (nborsum) {
- case 2:
- return c;
- case 3:
- return 1;
- default:
- return 0;
- }
- }
-