Script request thread

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

Re: Script request thread

Post by Macbi » December 28th, 2017, 9:59 am

calcyman wrote:For non-totalistic isotropic rules, it delegates to ntcanon.py.
Thanks, that's exactly what I was looking for

User avatar
dani
Posts: 1004
Joined: October 27th, 2017, 3:43 pm
Location: New Jersey, USA
Contact:

Re: Script request thread

Post by dani » January 7th, 2018, 1:25 am

A version of apgluxe that quits and restarts if the ram usage exceeds a certain limit
she/her
moose#0915

User avatar
Apple Bottom
Posts: 1033
Joined: July 27th, 2015, 2:06 pm
Contact:

Re: Script request thread

Post by Apple Bottom » January 7th, 2018, 6:25 am

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!

muzik
Posts: 3850
Joined: January 28th, 2016, 2:47 pm
Location: Scotland

Re: Script request thread

Post by muzik » January 11th, 2018, 11:55 am

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?
Bored of using the Moore neighbourhood for everything? Introducing the Range-2 von Neumann isotropic non-totalistic rulespace!

User avatar
KittyTac
Posts: 533
Joined: December 21st, 2017, 9:58 am

Re: Script request thread

Post by KittyTac » January 27th, 2018, 10:56 am

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 » January 27th, 2018, 5:53 pm

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: 1497
Joined: January 12th, 2018, 9:19 pm

Re: Script request thread

Post by 77topaz » January 29th, 2018, 3:16 am

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)?

User avatar
dani
Posts: 1004
Joined: October 27th, 2017, 3:43 pm
Location: New Jersey, USA
Contact:

Re: Script request thread

Post by dani » January 29th, 2018, 10:27 am

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
she/her
moose#0915

User avatar
rowett
Moderator
Posts: 2071
Joined: January 31st, 2013, 2:34 am
Location: UK
Contact:

Re: Script request thread

Post by rowett » January 29th, 2018, 1:00 pm

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: 524
Joined: November 20th, 2017, 12:22 pm
Location: 'Merica

Re: Script request thread

Post by Majestas32 » January 29th, 2018, 5:54 pm

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
Please, stop spam searching Snowflakes.

User avatar
toroidalet
Posts: 1097
Joined: August 7th, 2016, 1:48 pm
Location: My computer
Contact:

Re: Script request thread

Post by toroidalet » January 29th, 2018, 8:59 pm

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!
"Build a man a fire and he'll be warm for a day. Set a man on fire and he'll be warm for the rest of his life."

-Terry Pratchett

User avatar
Majestas32
Posts: 524
Joined: November 20th, 2017, 12:22 pm
Location: 'Merica

Re: Script request thread

Post by Majestas32 » January 29th, 2018, 9:06 pm

Ah thank
Please, stop spam searching Snowflakes.

User avatar
Majestas32
Posts: 524
Joined: November 20th, 2017, 12:22 pm
Location: 'Merica

Re: Script request thread

Post by Majestas32 » January 29th, 2018, 9:07 pm

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.
Please, stop spam searching Snowflakes.

User avatar
77topaz
Posts: 1497
Joined: January 12th, 2018, 9:19 pm

Re: Script request thread

Post by 77topaz » January 29th, 2018, 9:36 pm

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.

User avatar
dani
Posts: 1004
Joined: October 27th, 2017, 3:43 pm
Location: New Jersey, USA
Contact:

Re: Script request thread

Post by dani » February 3rd, 2018, 3:50 pm

Can someone update this script to reflect the new catagolue changes?
she/her
moose#0915

User avatar
Rhombic
Posts: 1064
Joined: June 1st, 2013, 5:41 pm

Re: Script request thread

Post by Rhombic » February 5th, 2018, 12:23 pm

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: 219
Joined: January 24th, 2018, 4:36 pm

Re: Script request thread

Post by googleplex » February 6th, 2018, 11:19 am

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: 1497
Joined: January 12th, 2018, 9:19 pm

Re: Script request thread

Post by 77topaz » February 6th, 2018, 4:19 pm

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: 219
Joined: January 24th, 2018, 4:36 pm

Re: Script request thread

Post by googleplex » February 6th, 2018, 5:47 pm

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: 3496
Joined: June 19th, 2015, 8:50 pm
Location: In the kingdom of Sultan Hamengkubuwono X
Contact:

Re: Script request thread

Post by Saka » February 9th, 2018, 3:49 am

A script that outputs the black/white reversal of a non-totalistic rule.

Code: Select all

o3b2ob2obo3b2o2b2o$bo3b2obob3o3bo2bo$2bo2b3o5b3ob4o$3o3bo2bo2b3o3b3o$
4bo4bobo4bo$2o2b2o2b4obo2bo3bo$2ob4o3bo2bo2bo2bo$b2o3bobob2o$3bobobo5b
obobobo$3bobobob2o3bo2bobo!
(Check gen 3)
Add your computer to the Table of Lifeenthusiast Computers!

User avatar
Majestas32
Posts: 524
Joined: November 20th, 2017, 12:22 pm
Location: 'Merica

Re: Script request thread

Post by Majestas32 » February 9th, 2018, 10:22 am

And the checkerboard dual too
Please, stop spam searching Snowflakes.

User avatar
77topaz
Posts: 1497
Joined: January 12th, 2018, 9:19 pm

Re: Script request thread

Post by 77topaz » February 9th, 2018, 3:25 pm

Majestas32 wrote:And the checkerboard dual too
Though, isn't it only rules with the Von Neumann neighbourhood that have checkerboard duals?

User avatar
A for awesome
Posts: 2063
Joined: September 13th, 2014, 5:36 pm
Location: 0x-1
Contact:

Re: Script request thread

Post by A for awesome » February 9th, 2018, 5:42 pm

77topaz wrote:Though, isn't it only rules with the Von Neumann neighbourhood that have checkerboard duals?
Only self-complementary rules, actually.
x₁=ηx
V ⃰_η=c²√(Λη)
K=(Λu²)/2
Pₐ=1−1/(∫^∞_t₀(p(t)ˡ⁽ᵗ⁾)dt)

$$x_1=\eta x$$
$$V^*_\eta=c^2\sqrt{\Lambda\eta}$$
$$K=\frac{\Lambda u^2}2$$
$$P_a=1-\frac1{\int^\infty_{t_0}p(t)^{l(t)}dt}$$

http://conwaylife.com/wiki/A_for_all

Aidan F. Pierce

User avatar
vyznev
Posts: 27
Joined: April 23rd, 2016, 4:08 am

Re: Script request thread

Post by vyznev » February 9th, 2018, 5:55 pm

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: 524
Joined: November 20th, 2017, 12:22 pm
Location: 'Merica

Re: Script request thread

Post by Majestas32 » February 9th, 2018, 9:53 pm

Isotropic. And I think Calcyman talked about every rule actually having a strobing checkerboard dual?
Please, stop spam searching Snowflakes.

Post Reply