/*** /
+[This file is part of Bedbugs. All I've done is made it implement
+the Conway transition function. Original copyright notice follows:]
+
This file is part of Golly, a Game of Life Simulator.
Copyright (C) 2008 Andrew Trevorrow and Tomas Rokicki.
// (for von Neumann neighbourhoods, just ignore the nw,se,sw,ne inputs)
state slowcalc(state nw,state n,state ne,state w,state c,state e,state sw,state s,state se)
{
- // wireworld:
+ int neighbours = nw+n+ne+e+se+s+sw+w;
+ // Conway:
switch (c)
{
- case 0: return 0 ;
- case 1: return 2 ;
- case 2: return 3 ;
- case 3:
- if ((((1+(nw==1)+(n==1)+(ne==1)+(w==1)+(e==1)+(sw==1)+
- (s==1)+(se==1))) | 1) == 3)
- return 1 ;
- else
- return 3 ;
+ case 0:
+ if (neighbours == 3) {
+ return 1;
+ } else {
+ return 0;
+ }
+ case 1:
+ if (neighbours == 2 || neighbours == 3) {
+ return 1;
+ } else {
+ return 0;
+ }
default:
return 0 ; // should throw an error here
}
int main()
{
// parameters for use:
- const int N_STATES = 4;
- const TSymm symmetry = rotate8;
+ const int N_STATES = 2;
+ // Bedbugs: FIXME: output would probably be more efficient if we used
+ // this, but also complicated
+ const TSymm symmetry = none;
const int nhood_size = 9;
- const string output_filename = "wireworld.table";
- const bool remove_stasis_transitions = true;
+ const string output_filename = "life.table";
+ // Bedbugs: we need these because they will be munged into real
+ // transitions:
+ const bool remove_stasis_transitions = false;
vector<rule> rules;
time_t t1,t2;