wirehead wrote: ↑June 19th, 2022, 8:03 pm
If you or someone else would be interested in doing that, I'd love to help. I know Python and Javascript.
Okay, here's a possible starting point: have a look at
recognizer.py, and maybe try using it to produce a level-one structured description of some recent piece of circuitry, like the
glider-to-[weekender|doo-dah] converter. If the README isn't clear enough to help you get it working, let me know and I'll post some kind of walkthrough for it.
If the code is unreadable, feel free to rewrite it. What it does isn't all that complicated, and so it works pretty fast to "recognize" even a fairly large pattern and write out a compact script to re-create it -- once the library of component pieces has been defined.
Things that would be nice to be able to add:
1) XOR "patch" patterns -- when a subpattern is _almost_ the same as something in the library, it would be great to be able to generate a small patch showing the cells that are different between the standard library pattern and the (usually custom-welded) variant in the actual full pattern. The "standard object plus XOR patch" could then be recursively defined as a new named object, "syringe_plus_welded_eater" or whatever.
2) multi-level defined patterns in general. For example, in the existing glider-to-weekender defined pattern, the smallest defined units in the library are Herschel-based glider reflectors -- a syringe plus a Herschel conduit plus a H-to-G converter, let's say. But a recursive definition would allow the syringe, the Herschel conduit, and the H-to-G to be defined separately, and then the combination of the three could be called "180_degree_glider_reflector_1" or whatever -- with XOR patches holding the parts together whenever a weld is necessary. And then "syringe" itself could be defined as eater plus block plus beehive-with-tail plus syringe_catalyst.
(I suppose beehive-with-tail could then be defined as "beehive" plus "tail", but that might be taking things a little bit too far. We definitely don't want to get down as far as "block" = "cell" plus "cell" plus "cell" plus "cell".)
The Secret Ambition Behind All of This
As described way back in
this post, there's a type of Life editor that would naturally use this kind of recursive definition as its input and output format, once the syntax is all figured out and in working order. The idea is to be able to select several smaller objects and click "group" to group them together and give them a name -- or select one larger-scale object and click "ungroup" to convert it into its next lower-level named objects.
Then we'd be able to do things like build different periods of guns just by click-and-dragging "
trombone_slide_adjuster", and the adjuster component (made out of two attached Snarks, maybe) would never get out of alignment, because it would always snap to the nearest valid location.
Years ago Andrew Trevorrow added a mechanism that would allow this kind of editor to be added to Golly with no changes to Golly's code base -- in the form of a Lua "overlay" script. The learning curve for using the Lua overlay is apparently steep enough that few people have made the effort to figure it out and do wonderful things with it -- but wonderful things can obviously be done, as evidenced by Chris Rowett's breakout.lua and overlay-demo.lua.