/*
    bomb - automatic interactive visual stimulation
    Copyright (C) 1994  Scott Draves <spot@cs.cmu.edu>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include "defs.h"

#define imprint_test   0

#define numer          5
#define denom          8
#define lost           (256 - ((256 * numer) / denom))

void
step_rule_static(int frame, rule_t *p, image8_t *fb)
{
   int x,y,bx,by;
   int r;
   u_char *lp;

   for (y = 1; y <= YSIZE; y++) {
      lp = fb->p + (fb->stride * (y - 1));
      for (x = 1; x <= XSIZE; x++) {
	 /* fuckers must only give us 31 bits.  it's nuts
	    to use fully random #s here anyway */
	 r = (x&1) ? (r >> 8) : R;
#if imprint_test
	 if (x > 50 && x < 150 && y > 50 && y < 150) {
	    *(lp++) = ((r&255) * numer) / denom + lost/2;
	 } else
#endif
	    *(lp++) = r;
      }
   }
}
