ConwayLife.com - A community for Conway's Game of Life and related cellular automata
Home  •  LifeWiki  •  Forums  •  Download Golly

Script request thread

For scripts to aid with computation or simulation in cellular automata.

Re: Script request thread

Postby dvgrn » February 7th, 2019, 7:01 pm

Moosey wrote:problem:
{screenshot} (text might be better for a problem report, by the way, since it's searchable)
SyntaxError: Non-ASCII character '\xc2' in file ...simkin random G collisions.py on line 58, but no encoding declared: see http://python.org/dev/peps/pep-0263/ for details

This is a problem with almost any python script I get from Conwaylife.com

Should be solvable. Did you look at the web page the error suggested you should look at? I guess it's pretty opaque... a Google search on the error message text will probably work a lot better. Try adding
# -*- coding: utf-8 -*-

as a new first line of your Python scripts. (And if that doesn't work, keep doing similar searches and try whatever suggestions come up, especially on Stack Exchange.)

You might be saving Python files using a text editor or IDE that has a different default character encoding than conwaylife'com ("<meta http-equiv="content-type" content="text/html; charset=UTF-8" />"). You could probably change that default encoding in your text editor, as another way to solve the problem.
User avatar
dvgrn
Moderator
 
Posts: 5629
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI

Re: Script request thread

Postby calcyman » February 8th, 2019, 7:23 am

dvgrn wrote:
Moosey wrote:A script that throws together random n-glider synthesis in CGoL, please.
Python.
You’d give it a number n and it would output a random n-G synth.

Check out simsim314's script from... yikes, that was almost five years ago already. It might not precisely match your request, but it might be close enough, and it should be easy to make adjustments.


Another thing you can do nowadays, that seems to be under-utilised: if you write a program (in any language) which prints RLEs of glider syntheses, you can pipe it into apgsearch (compiled with a symmetry containing 'stdin' as a substring) and it will search those as 'soups' instead of 16x16 pseudorandom soups. Everything else is unchanged, so it still uploads to Catagolue (and /hashsoup gives you back the original RLEs as intended). Here's an example:

https://catagolue.appspot.com/object/ov_q6/b3s23

I think there's a limit of 2000 characters per RLE, so you can't search huge soups in this manner, but it certainly gives you much more freedom than the regular symmetries (and accepts multistate RLEs). These RLEs are considered to begin with a line starting 'x' (as RLEs do, because they have a header line "x = ..., y = ...") and end with the next exclamation mark.

Note: this is not compatible with apgsearch's parallel mode.

Also not completely relevant: is the code checked in somewhere that would get apgsearch to submit random unidirectional slow-salvo "soups"? Or is that something only calcyman can do? (I haven't tried looking around in gitlab/apgoucher yet.)


HoneySearch has certainly been open-source for a while now, hiding in slmake. But it's not particularly user-friendly.
What do you do with ill crystallographers? Take them to the mono-clinic!
User avatar
calcyman
 
Posts: 2028
Joined: June 1st, 2009, 4:32 pm

Re: Script request thread

Postby Moosey » February 11th, 2019, 6:47 pm

dvgrn wrote:
Moosey wrote:problem:
{screenshot} (text might be better for a problem report, by the way, since it's searchable)
SyntaxError: Non-ASCII character '\xc2' in file ...simkin random G collisions.py on line 58, but no encoding declared: see http://python.org/dev/peps/pep-0263/ for details

This is a problem with almost any python script I get from Conwaylife.com

Should be solvable. Did you look at the web page the error suggested you should look at? I guess it's pretty opaque... a Google search on the error message text will probably work a lot better. Try adding
# -*- coding: utf-8 -*-

as a new first line of your Python scripts. (And if that doesn't work, keep doing similar searches and try whatever suggestions come up, especially on Stack Exchange.)

You might be saving Python files using a text editor or IDE that has a different default character encoding than conwaylife'com ("<meta http-equiv="content-type" content="text/html; charset=UTF-8" />"). You could probably change that default encoding in your text editor, as another way to solve the problem.

I tried fixing that on a different file, and it worked, but now I have a new problem:
File "/Users/Moosey/Desktop/cellular automata/Golly-3.2-Mac/Scripts/Python/Brett Breger APGcode.py", line 9
      initpop = int(g.getpop())
  ^
SyntaxError: invalid syntax

Something similar happens in the simkin G collisions script.,

Also, can I have a python code (without either problem) that finds 20x20 or smaller methuselahs in a supplied nontotalistic rule?
It should display the smallest methuselah.
My rules:
They can be found here

Also, the tree game
Bill Watterson once wrote: "How do soldiers killing each other solve the world's problems?"
User avatar
Moosey
 
Posts: 1526
Joined: January 27th, 2019, 5:54 pm
Location: A house, or perhaps the OCA board.

Re: Script request thread

Postby dvgrn » February 11th, 2019, 7:49 pm

Moosey wrote:I tried fixing that on a different file, and it worked, but now I have a new problem:
File "/Users/Moosey/Desktop/cellular automata/Golly-3.2-Mac/Scripts/Python/Brett Breger APGcode.py", line 9
      initpop = int(g.getpop())
  ^
SyntaxError: invalid syntax

Can't help you on that one without more context -- except to say that this is one of Python's least user-friendly details. See where the ^ pointer is? The error is called out as line 9, but the actual error is something missing at the end of line 8 -- usually a missing right parenthesis or something along those lines.

Moosey wrote:Also, can I have a python code (without either problem) that finds 20x20 or smaller methuselahs in some nontotalistic rule?

How about a Larger than Life rule? This could be adapted to search other rules, though it's not trivial because methuseblobs tend to disappear cleanly where methuselahs in most rules leave a lot of mess behind.

To solve that problem, you might do something along the lines of what the methuselah fingerprinter script does, starting with random soups in whatever rule you want. You can find out exactly how long a methuselah takes to settle by taking its population-delta fingerprint and removing all the trailing zeroes.

That will generally get you to within one "stride" of the settling point, anyway, whatever number of ticks that might be for your chosen rule. It depends on the LCD of all the oscillator periods that show up sufficiently often in random ash.

I'm guessing it will probably seem like a difficult task to adapt either of these pieces of code to do exactly what you want. On the other hand, putting in some serious time trying to do this kind of thing yourself is a very good way of clarifying what you want, and how much you want it -- and it also tends to get other people more interested in helping with any problems that might come up.
User avatar
dvgrn
Moderator
 
Posts: 5629
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI

Re: Script request thread

Postby Gustone » May 10th, 2019, 6:20 am

A script that outputs the min-max rules for a pattern, then (if it is a oscillator or spaceship in the original rule) list of rules where it evolves into itself but not as in the original rule and is not a still life.
Range-1 Moore isotropic only, also no B0.
(and sorry for my google translator level english)
KNIGHTSHIP Y U ALMOST
x = 414, y = 95, rule = B3/S23
412bo$413bo$413bo$413bo$413bo$413bo$413bo$413bo$413bo$413bo$413bo$413b
o$413bo$413bo$413bo$413bo$413bo65$o$2o$bo$bo$bo$bo$bo$bo$bo$bo$bo$bo$b
o$bo!
User avatar
Gustone
 
Posts: 147
Joined: March 6th, 2019, 2:26 am

Re: Script request thread

Postby fluffykitty » May 10th, 2019, 1:36 pm

Pretty sure that's uncomputable in general (set the main rule to one where gliders are spinners or something and blocks are stable, and have the pattern be a seed for an arbitrary TM emulator in Life that is also programmed to return to the original configuration upon halting)
I like making rules
fluffykitty
 
Posts: 576
Joined: June 14th, 2014, 5:03 pm

Re: Script request thread

Postby Ian07 » May 10th, 2019, 2:57 pm

Gustone wrote:A script that outputs the min-max rules for a pattern, then (if it is a oscillator or spaceship in the original rule) list of rules where it evolves into itself but not as in the original rule and is not a still life.
Range-1 Moore isotropic only, also no B0.

isorule.py might be what you're looking for for the first one. I understand what you mean in the latter case, (e.g. DryLife goldenhead) though I'm not sure how to modify it to count those cases since most of the code was written by Rhombic.
Ian07
 
Posts: 213
Joined: September 22nd, 2018, 8:48 am

Re: Script request thread

Postby fluffykitty » May 10th, 2019, 3:01 pm

Well, if it's "with the same period and displacement" then it's (somewhat) efficiently computable by DFSing the isotropic rulespace, but that would probably work better with a dedicated program due to all the ruleswitching
I like making rules
fluffykitty
 
Posts: 576
Joined: June 14th, 2014, 5:03 pm

Re: Script request thread

Postby Gustone » May 11th, 2019, 5:33 am

fluffykitty wrote:Well, if it's "with the same period and displacement" then it's (somewhat) efficiently computable by DFSing the isotropic rulespace, but that would probably work better with a dedicated program due to all the ruleswitching

No, it does NOT have to be the same period and/or displacement.
(and sorry for my google translator level english)
KNIGHTSHIP Y U ALMOST
x = 414, y = 95, rule = B3/S23
412bo$413bo$413bo$413bo$413bo$413bo$413bo$413bo$413bo$413bo$413bo$413b
o$413bo$413bo$413bo$413bo$413bo65$o$2o$bo$bo$bo$bo$bo$bo$bo$bo$bo$bo$b
o$bo!
User avatar
Gustone
 
Posts: 147
Joined: March 6th, 2019, 2:26 am

Re: Script request thread

Postby Moosey » May 11th, 2019, 7:52 am

Gustone wrote:
fluffykitty wrote:Well, if it's "with the same period and displacement" then it's (somewhat) efficiently computable by DFSing the isotropic rulespace, but that would probably work better with a dedicated program due to all the ruleswitching

No, it does NOT have to be the same period and/or displacement.

They might be difficult—

an ambitious searcher wrote:Find all the rules where the LWSS...
Travels at c in any orthogonal direction
Travels at c/2 in any direction
Travels at 2c/2 in any orthogonal direction
Travels at c/3 in any direction
Travels at 2c/3 in any direction (possibly only orthogonal)
Travels at 3c/3 in any orthogonal direction
...
Oscillates


It would probably be hard to code for, especially if you want some fancy deluxe features (e.g. Outputting the object’s RLE when it is at minimum population)
My rules:
They can be found here

Also, the tree game
Bill Watterson once wrote: "How do soldiers killing each other solve the world's problems?"
User avatar
Moosey
 
Posts: 1526
Joined: January 27th, 2019, 5:54 pm
Location: A house, or perhaps the OCA board.

Re: Script request thread

Postby Gustone » May 11th, 2019, 8:08 am

Moosey wrote:
Gustone wrote:
fluffykitty wrote:Well, if it's "with the same period and displacement" then it's (somewhat) efficiently computable by DFSing the isotropic rulespace, but that would probably work better with a dedicated program due to all the ruleswitching

No, it does NOT have to be the same period and/or displacement.

They might be difficult—

an ambitious searcher wrote:Find all the rules where the LWSS...
Travels at c in any orthogonal direction
Travels at c/2 in any direction
Travels at 2c/2 in any orthogonal direction
Travels at c/3 in any direction
Travels at 2c/3 in any direction (possibly only orthogonal)
Travels at 3c/3 in any orthogonal direction
...
Oscillates


It would probably be hard to code for, especially if you want some fancy deluxe features (e.g. Outputting the object’s RLE when it is at minimum population)

No I dont want minimum rle, it will just run a pattern in every non b0 and/or b1 and/or s012345678 rule where it evolves diffirently and find in what rules it evolves into itself, no matter the displacement or rotation.
(and sorry for my google translator level english)
KNIGHTSHIP Y U ALMOST
x = 414, y = 95, rule = B3/S23
412bo$413bo$413bo$413bo$413bo$413bo$413bo$413bo$413bo$413bo$413bo$413b
o$413bo$413bo$413bo$413bo$413bo65$o$2o$bo$bo$bo$bo$bo$bo$bo$bo$bo$bo$b
o$bo!
User avatar
Gustone
 
Posts: 147
Joined: March 6th, 2019, 2:26 am

Re: Script request thread

Postby Moosey » May 11th, 2019, 8:13 am

Gustone wrote:snip
No I dont want minimum rle, it will just run a pattern in every non b0 and/or b1 and/or s012345678 rule and find in what rules it evolves into itself, no matter the displacement or rotation.

Oh good, then you want the most barebones version of your script. That might be doable for someone who actually knows how to make scripts.
Last edited by Moosey on June 7th, 2019, 3:38 pm, edited 1 time in total.
My rules:
They can be found here

Also, the tree game
Bill Watterson once wrote: "How do soldiers killing each other solve the world's problems?"
User avatar
Moosey
 
Posts: 1526
Joined: January 27th, 2019, 5:54 pm
Location: A house, or perhaps the OCA board.

Re: Script request thread

Postby dvgrn » May 11th, 2019, 9:02 am

Gustone wrote:No I dont want minimum rle, it will just run a pattern in every non b0 and/or b1 and/or s012345678 rule where it evolves [differently] and find in what rules it evolves into itself, no matter the displacement or rotation.

That script is writable as described, but it couldn't be run to completion. If I'm thinking about it right, you've excluded roughly four isotropic bits, leaving about 2^98 isotropic range-1 Moore-neighborhood rules to search through.

That's over 10^29 rules, which is more than the number of stars in the universe or the number of microseconds since the Big Bang. You could maybe exclude the B2 transitions as well, but it wouldn't make much practical difference.

So even if you can check one rule per microsecond (which is more than a little unlikely with a Golly script, especially since you haven't specified a maximum number of ticks to check for matches) you're going to be waiting a mighty long time for a complete report of workable rules.

Maybe test randomly chosen rules for N seconds? That probably wouldn't find anything in a reasonable amount of time, though. Or just test all rules that are [N=1, 2, 3...] transitions away from a given rule? That's doable for small N, but gets a couple of orders of magnitude harder every time N increases by 1, so that search would get bogged down fairly quickly too -- and it would probably find mostly trivial matches, where a particular isotropic bit is barely used and just produces some change that dies away and returns to the same evolutionary sequence.

There are only a few tens of thousands of Life-Like rules, so a script to survey those would be a much more reasonable goal.
User avatar
dvgrn
Moderator
 
Posts: 5629
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI

Re: Script request thread

Postby fluffykitty » May 11th, 2019, 1:21 pm

fluffykitty wrote:Pretty sure that's uncomputable in general (set the main rule to one where gliders are spinners or something and blocks are stable, and have the pattern be a seed for an arbitrary TM emulator in Life that is also programmed to return to the original configuration upon halting)

so you can't even do it in theory, if the maximum period is unbounded. However, if there's a maximum period, then it is possible, by just doing a depth first search of the isotropic rulespace and looking for rules where the pattern repeats before the period limit (and possibly optimizing out B1e/B2a explosions, B0, S01234, and other isotropic transition combinations that make spaceships impossible), which would be much fore efficient than just brute force searching all isotropic rules (which is computationally infeasible)
I like making rules
fluffykitty
 
Posts: 576
Joined: June 14th, 2014, 5:03 pm

Re: Script request thread

Postby Gustone » May 11th, 2019, 3:59 pm

dvgrn wrote:
Gustone wrote:No I dont want minimum rle, it will just run a pattern in every non b0 and/or b1 and/or s012345678 rule where it evolves [differently] and find in what rules it evolves into itself, no matter the displacement or rotation.

That script is writable as described, but it couldn't be run to completion. If I'm thinking about it right, you've excluded roughly four isotropic bits, leaving about 2^98 isotropic range-1 Moore-neighborhood rules to search through.

That's over 10^29 rules, which is more than the number of stars in the universe or the number of microseconds since the Big Bang. You could maybe exclude the B2 transitions as well, but it wouldn't make much practical difference.

So even if you can check one rule per microsecond (which is more than a little unlikely with a Golly script, especially since you haven't specified a maximum number of ticks to check for matches) you're going to be waiting a mighty long time for a complete report of workable rules.

Maybe test randomly chosen rules for N seconds? That probably wouldn't find anything in a reasonable amount of time, though. Or just test all rules that are [N=1, 2, 3...] transitions away from a given rule? That's doable for small N, but gets a couple of orders of magnitude harder every time N increases by 1, so that search would get bogged down fairly quickly too -- and it would probably find mostly trivial matches, where a particular isotropic bit is barely used and just produces some change that dies away and returns to the same evolutionary sequence.

There are only a few tens of thousands of Life-Like rules, so a script to survey those would be a much more reasonable goal.

Well, a set period in some thousands of rules closest to the original one, but it wont survey rules where it evolves exactly like in the original one.
(and sorry for my google translator level english)
KNIGHTSHIP Y U ALMOST
x = 414, y = 95, rule = B3/S23
412bo$413bo$413bo$413bo$413bo$413bo$413bo$413bo$413bo$413bo$413bo$413b
o$413bo$413bo$413bo$413bo$413bo65$o$2o$bo$bo$bo$bo$bo$bo$bo$bo$bo$bo$b
o$bo!
User avatar
Gustone
 
Posts: 147
Joined: March 6th, 2019, 2:26 am

Re: Script request thread

Postby Moosey » May 11th, 2019, 4:01 pm

Gustone wrote:
dvgrn wrote:<snip>

Well, a set period in some thousands of rules closest to the original one, but it wont survey rules where it evolves exactly like in the original one.

How would you know in which rules it evolves exactly like in the base rule?
My rules:
They can be found here

Also, the tree game
Bill Watterson once wrote: "How do soldiers killing each other solve the world's problems?"
User avatar
Moosey
 
Posts: 1526
Joined: January 27th, 2019, 5:54 pm
Location: A house, or perhaps the OCA board.

Re: Script request thread

Postby fluffykitty » May 11th, 2019, 9:51 pm

Why is everyone ignoring me?
I like making rules
fluffykitty
 
Posts: 576
Joined: June 14th, 2014, 5:03 pm

Re: Script request thread

Postby dvgrn » May 11th, 2019, 10:25 pm

fluffykitty wrote:Why is everyone ignoring me?

Don't think anyone is. You've been saying things that are true, and therefore they didn't seem to need to be replied to.

I wasn't sure if "uncomputable" meant very much to Moosey and Gustone, let alone the reference to Halting Problem-type uncomputability. So I tried explaining in more detail how impractical it would be to try to survey all isotropic rules, or any significant fraction of them.
User avatar
dvgrn
Moderator
 
Posts: 5629
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI

Re: Script request thread

Postby fluffykitty » May 11th, 2019, 10:48 pm

I guess that makes sense.
I like making rules
fluffykitty
 
Posts: 576
Joined: June 14th, 2014, 5:03 pm

Re: Script request thread

Postby Ian07 » June 7th, 2019, 3:29 pm

Does anyone have an RLE-to-apgcode script for Golly that allows for the extended format?
EDIT: Was able to do this using Python lifelib.
Ian07
 
Posts: 213
Joined: September 22nd, 2018, 8:48 am

Re: Script request thread

Postby wildmyron » June 7th, 2019, 10:01 pm

Ian07 wrote:Does anyone have an RLE-to-apgcode script for Golly that allows for the extended format?
EDIT: Was able to do this using Python lifelib.

Lifelib is probably the preferred option for generating canonical apgcodes, but if that's not available, or inconvenient, I believe this is the Python version which matches the greedy apgcodes implemented in Lifelib. I haven't verified this to be the case - would be good if someone can do so and we should probably clarify that on the LifeWiki.
The latest version of the 5S Project contains over 47,000 spaceships. Tabulated pages up to period 160 are available on the LifeWiki.
wildmyron
 
Posts: 1115
Joined: August 9th, 2013, 12:45 am

Re: Script request thread

Postby Ian07 » June 8th, 2019, 8:27 am

wildmyron wrote:I believe this is the Python version which matches the greedy apgcodes implemented in Lifelib. I haven't verified this to be the case - would be good if someone can do so and we should probably clarify that on the LifeWiki.

I just tried this with the asymmetric pre-pulsar spaceship and can confirm that it produces the exact same apgcode as lifelib.
Ian07
 
Posts: 213
Joined: September 22nd, 2018, 8:48 am

Previous

Return to Scripts

Who is online

Users browsing this forum: No registered users and 6 guests