enum seed_population seed;
};
+/* The following array contains rule numbers and starting seeds which were */
+/* preselected as being visually interesting. */
static const struct curated_ruleset curated_ruleset_list[] = {
{ 18, middle_cell},
{ 30, middle_cell},
unsigned short bg_red, bg_green, bg_blue;
};
+/* Since randomly selected colors would occasionally produce visually */
+/* indistinguishable foreground/background pairs, this array provides a */
+/* preselected list of complementary color pairs. */
static const struct color_pair color_list[] = {
/* For mapping X11 color names to RGB values: */
/* https://www.ehdp.com/methods/x11-color-names-rgb-values.htm */
/* Helper Functions */
/* -------------------------------------------------------------------------- */
+/* Some rules demonstrate behavior dominated by the starting seed. Thus, in */
+/* addition to a 50/50 random split of active/inactive cells, include other, */
+/* more biased random distributions in order to demonstrate such behavior. */
static void
randomize_seed_density(struct state * state)
{
bg.red = color_list[color_index].bg_red;
bg.green = color_list[color_index].bg_green;
bg.blue = color_list[color_index].bg_blue;
- /* TODO: Since I 'alloc', presumably I must also 'free' these colors */
- /* at some point. Where/how? I don't want to eventually crash my */
- /* X server after months of use. */
XAllocColor(state->dpy, xgwa.colormap, &fg);
XAllocColor(state->dpy, xgwa.colormap, &bg);
state->fg = gcv.foreground = fg.pixel;
return state->delay_microsec;
}
+static void
+WolframAutomata_reshape(Display * dpy, Window win, void * closure, unsigned int w, unsigned int h)
+{
+ struct state * state = closure;
+ XWindowAttributes xgwa;
+ XGetWindowAttributes(state->dpy, state->win, &xgwa);
+
+ /* Only restart the simulation if the window changed size. */
+ if (state->dpy_width != xgwa.width || state->dpy_height != xgwa.height) {
+ WolframAutomata_free(dpy, win, closure);
+ closure = WolframAutomata_init(dpy, win);
+ }
+}
+
static const char * WolframAutomata_defaults[] = {
"*admiration-delay: 5",
{ 0, 0, 0, 0 }
};
-static void
-WolframAutomata_reshape(Display * dpy, Window win, void * closure, unsigned int w, unsigned int h)
-{
- struct state * state = closure;
- XWindowAttributes xgwa;
- XGetWindowAttributes(state->dpy, state->win, &xgwa);
-
- /* Only restart the simulation if the window changed size. */
- if (state->dpy_width != xgwa.width || state->dpy_height != xgwa.height) {
- WolframAutomata_free(dpy, win, closure);
- closure = WolframAutomata_init(dpy, win);
- }
-}
-
XSCREENSAVER_MODULE ("1D Nearest-Neighbor Cellular Automata", WolframAutomata)