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

  1. /*
  2.  * File: heat.v256.c
  3.  *   By: Dave Hiebeler
  4.  *       hiebeler@turing.cs.rpi.edu
  5.  *       August 1989
  6.  *
  7.  * The "heat" rule in the von-Neumann neighborhood.  See the "heat.m256.c"
  8.  * file for more information on the heat rule itself.
  9.  *
  10.  * Try this with parm1 = 100 and parm2 = 2, starting from the "heat.64x"
  11.  * image.
  12.  */
  13.  
  14. #include "nborhood.h"
  15.  
  16. byte vonn_heat();
  17.  
  18. void
  19. init_function()
  20. {
  21.     update_function = vonn_heat;
  22. }
  23.  
  24.  
  25. byte
  26. vonn_heat(nbors)
  27. vonn_nbors *nbors;
  28. {
  29.     int heat_avg;
  30.  
  31.     Get_vonn_nbors;
  32.     
  33.     heat_avg = (l + c + r + t + b) / 5;
  34.     return (c + (heat_avg - c) * parm1 / 100 + parm2) % 256;
  35. }
  36.