Page 8 of 25

Re: Script request thread

Posted: December 28th, 2017, 9:59 am
by Macbi
calcyman wrote:For non-totalistic isotropic rules, it delegates to ntcanon.py.
Thanks, that's exactly what I was looking for

Re: Script request thread

Posted: January 7th, 2018, 1:25 am
by dani
A version of apgluxe that quits and restarts if the ram usage exceeds a certain limit

Re: Script request thread

Posted: January 7th, 2018, 6:25 am
by Apple Bottom
danny wrote:A version of apgluxe that quits and restarts if the ram usage exceeds a certain limit
You can probably rig up something using ulimit(1). Set a memory limit, and create a wrapper script that detects whether apgluxe aborted due to a failed allocation and restarts it if so.

Re: Script request thread

Posted: January 11th, 2018, 11:55 am
by muzik
Since Golly doesnt support them yet for some reason, can we get a script that changes a non-totalistic hexagonal rule into its MAP string?

Re: Script request thread

Posted: January 27th, 2018, 10:56 am
by KittyTac
A search script that can search bounded grids for objects. I want to search my favorite rule that I made, Platoon (B2cek3i/S12-ak).

Re: Script request thread

Posted: January 27th, 2018, 5:53 pm
by vyznev
muzik wrote:Since Golly doesnt support them yet for some reason, can we get a script that changes a non-totalistic hexagonal rule into its MAP string?
Here you go, this should do it: https://gist.github.com/vyznev/0ef7eb2a ... 647f10d685

The script can be used either as a Golly plugin or as a stand-along script with the rules given as command line arguments. When used on the command line, it can output either 3+22 character hex MAP rules or, with the optional --long-map (or -l) switch, 3+86 character rectangular MAP rules that simply ignore the NE and SW corner neighbors.

(When called from Golly, the script always generates 22 character MAP rules, since that way Golly will draw live cells as hexagons when zoomed in.)

I haven't tested this code very extensively, but it seems to work at least for the totalistic rule B245/S3H and for Paul Callahan's B2o/S2m34H, so I have some confidence that it may be working correctly in general. If you find any bugs, let me know.

Note that the hex rule parser ignores letter case and leading / trailing whitespace, but will reject rule strings with internal spaces or which lack the final "H". The parser will also silently accept repeated neighbor counts (of which the last one will take effect, if they're followed by different sets of letters), repeated letters for a given neighbor count (which are redundant anyway) and a minus sign followed by no letters (which is effectively ignored). It will, however, reject rules with invalid neighborhood type letters (i.e. other than o/m/p), as well as rules with neighborhood type letters following a digit other than 2, 3 or 4.

As a demonstration, here's Callahan's B2o/S2m34H glider gun:

Code: Select all

x = 25, y = 13, rule = MAPFAMgVwhXAP4AP4B+gH4A6A
17b2o$2bo15b2obo$b2obo13bob2o$2ob3o13b2ob2o$2bobobo13bobo$2b2ob4o3b2o
6bob2o$2bob2obo5b3o4b3obo$13bobo6bo$12b4o$12bo3bo$13b5o$15bo$15bo!
Alas, LifeViewer doesn't seem to currently support 3+22 character MAP rules, and so refuses to run the pattern above. To make it work here, the equivalent 3+86 character MAP rule has to be used:

Code: Select all

x = 25, y = 13, rule = MAPEUQAMyIAVXcRRAAzIgBVdwCIVXcAAP/uAIhVdwAA/+4AADP/iAB37gAAM/+IAHfuiAB37gAA7oiIAHfuAADuiA
17b2o$2bo15b2obo$b2obo13bob2o$2ob3o13b2ob2o$2bobobo13bobo$2b2ob4o3b2o
6bob2o$2bob2obo5b3o4b3obo$13bobo6bo$12b4o$12bo3bo$13b5o$15bo$15bo!

Re: Script request thread

Posted: January 29th, 2018, 3:16 am
by 77topaz
Is it possible to make a script that, given an apgcode, looks through Catagolue for rules where that apgcode has appeared and then returns the rule in which that pattern is the most common relative to other patterns (i.e. in which it appears the highest in the list of most common objects)?

Re: Script request thread

Posted: January 29th, 2018, 10:27 am
by dani
77topaz wrote:Is it possible to make a script that, given an apgcode, looks through Catagolue for rules where that apgcode has appeared and then returns the rule in which that pattern is the most common relative to other patterns (i.e. in which it appears the highest in the list of most common objects)?
This gets a +1 from me because I need to find that one rule where the bun evolves into a monogram

Re: Script request thread

Posted: January 29th, 2018, 1:00 pm
by rowett
vyznev wrote:Alas, LifeViewer doesn't seem to currently support 3+22 character MAP rules, and so refuses to run the pattern above.
The support is built and will be in the next released build.

Re: Script request thread

Posted: January 29th, 2018, 5:54 pm
by Majestas32
danny wrote:
77topaz wrote:Is it possible to make a script that, given an apgcode, looks through Catagolue for rules where that apgcode has appeared and then returns the rule in which that pattern is the most common relative to other patterns (i.e. in which it appears the highest in the list of most common objects)?
This gets a +1 from me because I need to find that one rule where the bun evolves into a monogram
I also need to find the rule with the xp104_hexeh and xp14_eh so +1

Also the xp170 OMOS from my avatar

Re: Script request thread

Posted: January 29th, 2018, 8:59 pm
by toroidalet
77topaz wrote:Is it possible to make a script that, given an apgcode, looks through Catagolue for rules where that apgcode has appeared and then returns the rule in which that pattern is the most common relative to other patterns (i.e. in which it appears the highest in the list of most common objects)?
(even though I only know Javascript and not much of it)
A brute-force search of all 2^98 (about 3.17*10^29) (excluding B0, B1 and B2a) possible non-totalistic rules seems impractical. How would this limitation be surpassed?
Majestas32 wrote:Also the xp170 OMOS from my avatar
B2i3-ck6/S2-i35n

Code: Select all

x = 7, y = 3, rule = B2i3-ck4e6/S2-i35n
o5bo$2o3b2o$o5bo!

Re: Script request thread

Posted: January 29th, 2018, 9:06 pm
by Majestas32
Ah thank

Re: Script request thread

Posted: January 29th, 2018, 9:07 pm
by Majestas32
toroidalet wrote: A brute-force search of all 2^98 (about 3.17*10^29) (excluding B0, B1 and B2a) possible non-totalistic rules seems impractical. How would this limitation be surpassed?
I mean only a few thousand of those rules have been searched on Catagolue tho.

Re: Script request thread

Posted: January 29th, 2018, 9:36 pm
by 77topaz
Majestas32 wrote:
toroidalet wrote: A brute-force search of all 2^98 (about 3.17*10^29) (excluding B0, B1 and B2a) possible non-totalistic rules seems impractical. How would this limitation be surpassed?
I mean only a few thousand of those rules have been searched on Catagolue tho.
Indeed, that was my point, the Catagolue database is of a size a lot smaller than 10^29; it should be searchable.

Re: Script request thread

Posted: February 3rd, 2018, 3:50 pm
by dani
Can someone update this script to reflect the new catagolue changes?

Re: Script request thread

Posted: February 5th, 2018, 12:23 pm
by Rhombic
In case anyone wants to play around with rulespaces, I have made three hopefully useful scripts for converting a range of rules to a partial rule (in Macbi format), to obtain a partial rule from the evolution of a pattern and this one that I am listing here that calculates the cardinality of a given partial rule:

Code: Select all

# cardinality.py (Rhombic, Feb 2018)
# Calculates the non-totalistic cardinality of a partial rule.
# The cardinality of a partial rule is the number of rules in the rulespace defined by the partial conditions.
# This script is Golly-independent.

print "Please input partial rules in appropriate format pB/S."
partial=raw_input("Partial rule:  ")[2:]
ntcvals=["c","ce","aceikn","aceijknqry","aceijknqrtwyz","aceijknqry","aceikn","ce","c"]
pbs=partial.split("/S")
names=["Birth","Survival"]
total=0
for W in [0,1]:
    pbs[W]+="/"
    for cells in xrange(9):
        if str(cells) in pbs[W]:
            pos=pbs[W].index(str(cells))
            for n in xrange(len(pbs[W])):
                if pbs[W][pos+n+1] in "012345678/":
                    length=n
                    break
                else:
                    pass
            if "-" not in pbs[W][pos:pos+length+1]:
                N=len(ntcvals[cells])-length
                total+=N
                print names[W]+" conditions for %d gave "%cells+str(N)+" new combinations."
            else:
                N=len(ntcvals[cells])-length+1
                total+=N
                print names[W]+" conditions for %d gave "%cells+str(N)+" new combinations."
        else:
            pass
print "2^"+str(total)+" rules available."
This one is Golly-independent.
For instance, the copperhead gives the partial rule pB3aijnqr4-aijknrtwyz5-cnqry6-cik7-e8/S02aceikn3aejnqry4-aknqrtw5-acijqry6-a7-c8 with a cardinality of 2^37 non-totalistic rules.
The goldenhead gives the partial rule pB3aijnqr4-aijknrtwyz5-cnqry6-ack7e8/S02aceikn3aeijnqry4-aknqrtw5-acijnqry6-ac8 with a cardinality of 2^33 non-totalistic rules available.

The copperhead is present in 16 times more rules than the goldenhead, therefore.
Interestingly, their partial rules are evidently mutually exclusive because they evolve differently.

For comparison, the glider works in 2^82 rules. The way I defined tRules (containing t-ships, gliders, the C2-symmetric xp6 and the cap p4) gives 2^54 rules. Since it is exponential, this is crazy orders of magnitude less than the gliders. (2^28 times less --> 0.01 parts per trillion).

Re: Script request thread

Posted: February 6th, 2018, 11:19 am
by googleplex
I would like a script that, given a rule and 1-4 elementary spaceships, finds all collisions and outputs them to an rle.

Re: Script request thread

Posted: February 6th, 2018, 4:19 pm
by 77topaz
googleplex wrote:I would like a script that, given a rule and 1-4 elementary spaceships, finds all collisions and outputs them to an rle.
Just two-spaceship collisions right? That's probably doable, but if you have more than two spaceships colliding finding "all" collisions becomes non-trivial (just look at the "enumerating three-glider collisions" thread, and that's for CGoL with one elementary spaceship).

Re: Script request thread

Posted: February 6th, 2018, 5:47 pm
by googleplex
77topaz wrote:
googleplex wrote:I would like a script that, given a rule and 1-4 elementary spaceships, finds all collisions and outputs them to an rle.
Just two-spaceship collisions right? That's probably doable, but if you have more than two spaceships colliding finding "all" collisions becomes non-trivial (just look at the "enumerating three-glider collisions" thread, and that's for CGoL with one elementary spaceship).
Yes, just two ship collisions.

Re: Script request thread

Posted: February 9th, 2018, 3:49 am
by Saka
A script that outputs the black/white reversal of a non-totalistic rule.

Re: Script request thread

Posted: February 9th, 2018, 10:22 am
by Majestas32
And the checkerboard dual too

Re: Script request thread

Posted: February 9th, 2018, 3:25 pm
by 77topaz
Majestas32 wrote:And the checkerboard dual too
Though, isn't it only rules with the Von Neumann neighbourhood that have checkerboard duals?

Re: Script request thread

Posted: February 9th, 2018, 5:42 pm
by praosylen
77topaz wrote:Though, isn't it only rules with the Von Neumann neighbourhood that have checkerboard duals?
Only self-complementary rules, actually.

Re: Script request thread

Posted: February 9th, 2018, 5:55 pm
by vyznev
A for awesome wrote:
77topaz wrote:Though, isn't it only rules with the Von Neumann neighbourhood that have checkerboard duals?
Only self-complementary rules, actually.
Hmm. If I'm not totally confused, all self-complementary isotropic rules on the square lattice should indeed have checkerboard duals, but the checkerboard duals of totalistic rules are totalistic only on the von Neumann neighborhood (or, more generally, on any neighborhood where all neighbors of each cell have the same color on the checkerboard). So in a way, you're both right, it just depends on which class of rules (totalistic or general isotropic) you consider.

Re: Script request thread

Posted: February 9th, 2018, 9:53 pm
by Majestas32
Isotropic. And I think Calcyman talked about every rule actually having a strobing checkerboard dual?