home *** CD-ROM | disk | FTP | other *** search
/ Photo CD Demo 1 / Demo.bin / cellsim / v2_5 / rule_src / modv2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-02-26  |  383 b   |  32 lines

  1. /*
  2.  * File: mod.v2.c
  3.  *   By: Dave Hiebeler
  4.  *       hiebeler@turing.cs.rpi.edu
  5.  *       August 1989
  6.  *
  7.  * Add up the neighbors and return the sum mod 2.
  8.  */
  9.  
  10.  
  11. #include "nborhood.h"
  12.  
  13. byte mod_rule();
  14.  
  15. void
  16. init_function()
  17. {
  18.     update_function = mod_rule;
  19. }
  20.  
  21.  
  22. byte
  23. mod_rule(nbors)
  24. vonn_nbors *nbors;
  25. {
  26. int sum;
  27.  
  28.     Get_vonn_nbors;
  29.     sum = t + c + b + l + r;
  30.     return (sum%2);
  31. }
  32.