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

  1. /*
  2.  * File: mod.v4.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 4.
  8.  */
  9.  
  10. #include "nborhood.h"
  11.  
  12. byte mod_rule();
  13.  
  14. void
  15. init_function()
  16. {
  17.     update_function = mod_rule;
  18. }
  19.  
  20.  
  21. byte
  22. mod_rule(nbors)
  23. vonn_nbors *nbors;
  24. {
  25. int sum;
  26.  
  27.     Get_vonn_nbors;
  28.     sum = t + c + b + l + r;
  29.     return (sum%4);
  30. }
  31.