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

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

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

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

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

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

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!

KittyTac
Posts: 533
Joined: December 21st, 2017, 9:58 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).

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

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!


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

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: 1004
Joined: October 27th, 2017, 3:43 pm
Location: New Jersey, USA
Contact:

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

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

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.

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

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

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

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

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

Ah thank

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

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.

77topaz
Posts: 1497
Joined: January 12th, 2018, 9:19 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.

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

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

Rhombic
Posts: 1064
Joined: June 1st, 2013, 5:41 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”?

Posts: 219
Joined: January 24th, 2018, 4:36 pm

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!

77topaz
Posts: 1497
Joined: January 12th, 2018, 9: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).

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

Saka
Posts: 3496
Joined: June 19th, 2015, 8:50 pm
Location: In the kingdom of Sultan Hamengkubuwono X
Contact:

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)

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

And the checkerboard dual too

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

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

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

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

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

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.

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