From: Aaron Taylor Date: Thu, 10 Jun 2021 21:46:50 +0000 (-0700) Subject: Cleaned up CLI flags for cell size in WolframAutomata source code and README. X-Git-Url: http://git.subgeniuskitty.com/screensavers/.git/commitdiff_plain/3093467611b471a707bc567e8d56ef3aeadc6b4f Cleaned up CLI flags for cell size in WolframAutomata source code and README. --- diff --git a/hacks/WolframAutomata/README.md b/hacks/WolframAutomata/README.md index 443d10d..d6e309f 100644 --- a/hacks/WolframAutomata/README.md +++ b/hacks/WolframAutomata/README.md @@ -165,11 +165,11 @@ Individual cells may be displayed as any square number of pixels (e.g. 1x1, 2x2, etc). Increasing the cell size may help with flickering on high DPI monitors displaying chaotic rulesets. -If neither of the following two options are passed, the simulation selects -whatever cell size it feels appropriate for the current simulation speed. +If neither of the following two options are passed, the simulation behaves as +though `-cell-size 2` was passed. - - **`-random-cell-size`**: Selects cell size of 2^N pixels for an `N` - randomly chosen in the inclusive range `0`-`5`. + - **`-random-cell-size`**: Randomly selects 1, 2, 4, 8, 16, or 32 as the cell + size on each reset of the simulation. - **`-cell-size N`**: Display each individual cell as an `N`x`N` square of pixels on the screen. diff --git a/hacks/WolframAutomata/WolframAutomata.c b/hacks/WolframAutomata/WolframAutomata.c index 65a7e5c..36f1c05 100644 --- a/hacks/WolframAutomata/WolframAutomata.c +++ b/hacks/WolframAutomata/WolframAutomata.c @@ -307,14 +307,14 @@ WolframAutomata_init(Display * dpy, Window win) state->gc = XCreateGC(state->dpy, state->win, GCForeground, &gcv); /* Set the size of each simulated cell to NxN pixels for cell_size=N. */ - if (get_boolean_resource(state->dpy, "random-pixel-size", "Boolean")) { + if (get_boolean_resource(state->dpy, "random-cell-size", "Boolean")) { /* Although we are choosing the pixel size 'randomly', a truly random */ /* selection would bias toward large numbers since there are more of */ /* them. To avoid this, we select a random number for a bit shift, */ /* resulting in a pixel size of 1, 2, 4, 8, 16 or 32, equally likely. */ state->cell_size = 1 << (random() % 6); } else { - state->cell_size = get_integer_resource(state->dpy, "pixel-size", "Integer"); + state->cell_size = get_integer_resource(state->dpy, "cell-size", "Integer"); } if (state->cell_size < 1) state->cell_size = 1; if (state->cell_size > state->dpy_width) state->cell_size = state->dpy_width; @@ -505,11 +505,11 @@ static const char * WolframAutomata_defaults[] = { "*delay-usec: 25000", "*admiration-delay: 5", "*num-generations: 5000", - "*pixel-size: 2", + "*cell-size: 2", "*color-index: -1", "*population-density: 50", "*population-single: False", - "*random-cellsize: False", + "*random-cell-size: False", "*random-delay: False", "*random-length: False", "*random-rule: False", @@ -521,11 +521,11 @@ static XrmOptionDescRec WolframAutomata_options[] = { { "-delay-usec", ".delay-usec", XrmoptionSepArg, 0 }, { "-admiration-delay", ".admiration-delay", XrmoptionSepArg, 0 }, { "-num-generations", ".num-generations", XrmoptionSepArg, 0 }, - { "-pixel-size", ".pixel-size", XrmoptionSepArg, 0 }, + { "-cell-size", ".cell-size", XrmoptionSepArg, 0 }, { "-color-index", ".color-index", XrmoptionSepArg, 0 }, { "-population-density", ".population-density", XrmoptionSepArg, 0 }, { "-population-single", ".population-single", XrmoptionNoArg, "True" }, - { "-random-cellsize", ".random-pixel-size", XrmoptionNoArg, "True" }, + { "-random-cell-size", ".random-cell-size", XrmoptionNoArg, "True" }, { "-random-delay", ".random-delay", XrmoptionNoArg, "True" }, { "-random-length", ".random-num-generations", XrmoptionNoArg, "True" }, { "-random-rule", ".rule-random", XrmoptionNoArg, "True" },