Script request thread

For scripts to aid with computation or simulation in cellular automata.
User avatar
Macbi
Posts: 917
Joined: March 29th, 2009, 4:58 am
Contact:

Re: Script request thread

Post by Macbi »

calcyman wrote:For non-totalistic isotropic rules, it delegates to ntcanon.py.
Thanks, that's exactly what I was looking for
dani
Posts: 1221
Joined: October 27th, 2017, 3:43 pm

Re: Script request thread

Post by dani »

A version of apgluxe that quits and restarts if the ram usage exceeds a certain limit
User avatar
Apple Bottom
Posts: 1034
Joined: July 27th, 2015, 2:06 pm
Contact:

Re: Script request thread

Post 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.
If you speak, your speech must be better than your silence would have been. — Arabian proverb

Catagolue: Apple Bottom • Life Wiki: Apple Bottom • Twitter: @_AppleBottom_

Proud member of the Pattern Raiders!
User avatar
muzik
Posts: 6558
Joined: January 28th, 2016, 2:47 pm
Location: Scotland

Re: Script request thread

Post 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?
Parity Replicator Collection v1.6 is now live - please send all relevant discoveries here.
User avatar
KittyTac
Posts: 547
Joined: December 21st, 2017, 9:58 am

Re: Script request thread

Post 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).
User avatar
vyznev
Posts: 27
Joined: April 23rd, 2016, 4:08 am

Re: Script request thread

Post 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!
User avatar
77topaz
Posts: 1496
Joined: January 12th, 2018, 9:19 pm

Re: Script request thread

Post 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)?
dani
Posts: 1221
Joined: October 27th, 2017, 3:43 pm

Re: Script request thread

Post 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
User avatar
rowett
Moderator
Posts: 4570
Joined: January 31st, 2013, 2:34 am
Location: UK
Contact:

Re: Script request thread

Post 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.
User avatar
Majestas32
Posts: 549
Joined: November 20th, 2017, 12:22 pm
Location: 'Merica

Re: Script request thread

Post 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
Searching:
b2-a5k6n7cs12-i3ij4k5j8
b2-a3c7cs12-i

Currently looking for help searching these rules.
User avatar
toroidalet
Posts: 1514
Joined: August 7th, 2016, 1:48 pm
Location: My computer
Contact:

Re: Script request thread

Post 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!
Any sufficiently advanced software is indistinguishable from malice.
User avatar
Majestas32
Posts: 549
Joined: November 20th, 2017, 12:22 pm
Location: 'Merica

Re: Script request thread

Post by Majestas32 »

Ah thank
Searching:
b2-a5k6n7cs12-i3ij4k5j8
b2-a3c7cs12-i

Currently looking for help searching these rules.
User avatar
Majestas32
Posts: 549
Joined: November 20th, 2017, 12:22 pm
Location: 'Merica

Re: Script request thread

Post 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.
Searching:
b2-a5k6n7cs12-i3ij4k5j8
b2-a3c7cs12-i

Currently looking for help searching these rules.
User avatar
77topaz
Posts: 1496
Joined: January 12th, 2018, 9:19 pm

Re: Script request thread

Post 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.
dani
Posts: 1221
Joined: October 27th, 2017, 3:43 pm

Re: Script request thread

Post by dani »

Can someone update this script to reflect the new catagolue changes?
User avatar
Rhombic
Posts: 1099
Joined: June 1st, 2013, 5:41 pm

Re: Script request thread

Post 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).
SoL : FreeElectronics : DeadlyEnemies : 6a-ite : Rule X3VI
what is “sesame oil”?
googleplex
Posts: 331
Joined: January 24th, 2018, 4:36 pm
Location: Minnesota, USA

Re: Script request thread

Post 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.
Look at me! I make patterns in golly and go on the forums! I wanna be Famous!
User avatar
77topaz
Posts: 1496
Joined: January 12th, 2018, 9:19 pm

Re: Script request thread

Post 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).
googleplex
Posts: 331
Joined: January 24th, 2018, 4:36 pm
Location: Minnesota, USA

Re: Script request thread

Post 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.
Look at me! I make patterns in golly and go on the forums! I wanna be Famous!
User avatar
Saka
Posts: 3627
Joined: June 19th, 2015, 8:50 pm
Location: Indonesia
Contact:

Re: Script request thread

Post by Saka »

A script that outputs the black/white reversal of a non-totalistic rule.
jarring cyan
User avatar
Majestas32
Posts: 549
Joined: November 20th, 2017, 12:22 pm
Location: 'Merica

Re: Script request thread

Post by Majestas32 »

And the checkerboard dual too
Searching:
b2-a5k6n7cs12-i3ij4k5j8
b2-a3c7cs12-i

Currently looking for help searching these rules.
User avatar
77topaz
Posts: 1496
Joined: January 12th, 2018, 9:19 pm

Re: Script request thread

Post by 77topaz »

Majestas32 wrote:And the checkerboard dual too
Though, isn't it only rules with the Von Neumann neighbourhood that have checkerboard duals?
User avatar
praosylen
Posts: 2449
Joined: September 13th, 2014, 5:36 pm
Location: Pembina University, Home of the Gliders
Contact:

Re: Script request thread

Post by praosylen »

77topaz wrote:Though, isn't it only rules with the Von Neumann neighbourhood that have checkerboard duals?
Only self-complementary rules, actually.
former username: A for Awesome
praosylen#5847 (Discord)

The only decision I made was made
of flowers, to jump universes to one of springtime in
a land of former winter, where no invisible walls stood,
or could stand for more than a few hours at most...
User avatar
vyznev
Posts: 27
Joined: April 23rd, 2016, 4:08 am

Re: Script request thread

Post 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.
User avatar
Majestas32
Posts: 549
Joined: November 20th, 2017, 12:22 pm
Location: 'Merica

Re: Script request thread

Post by Majestas32 »

Isotropic. And I think Calcyman talked about every rule actually having a strobing checkerboard dual?
Searching:
b2-a5k6n7cs12-i3ij4k5j8
b2-a3c7cs12-i

Currently looking for help searching these rules.
Post Reply