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: 5348
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: 1954
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

Bill Watterson once wrote: "How do soldiers killing each other solve the world's problems?"
User avatar
Moosey
 
Posts: 841
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: 5348
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI

Previous

Return to Scripts

Who is online

Users browsing this forum: No registered users and 1 guest