Compile Java Rule Program Example: Brain
Rule Program: Brian's Brain
Rule name:
void jcruleModes() { setWorld(1); // World type 1 (2D, torus) } int jcrule(int oldstate) { int count = nw + n + ne + w + self + e + sw + s + se; if (oldstate == 2) // If in refractory state... return 0; // ...become ready. if (oldstate == 1) // If firing... return 2; // ...go to refractory state. return count == 2 ? 1 : 0; /* If ready, fire if precisely two neighbours are firing. */ }
Using the Rule Compilation Server
Blank rule compilation form
Compile rule from file
by John Walker