Page 3 of 27

Re: Thread for your script-related questions

Posted: March 16th, 2020, 3:13 am
by Hunting
Is there any Golly script around that finds methuselahs?

Re: Thread for your script-related questions

Posted: March 16th, 2020, 3:26 am
by wildmyron
yujh wrote: March 14th, 2020, 5:30 am C++ isn't working and neither does python. :(
Nobody here can help you if you don't give us a lot more information about what isn't working. Which program are you trying to run? which version of the code do you have? What is your operating system and development environment? Which compiler are you using? What command did you try to run? What are the error messages you got?
Any exe files for spaceship searches?
Which particular utility are you trying to run?
There are exe versions of various search programs posted on the forum, e.g. here: https://conwaylife.com/forums/viewtopic.php?f=9&t=1476
I also posted some oldish versions of gfind and ntzfind on my GDrive: https://drive.google.com/open?id=1vLCvG ... nCeAa2dKpE
In general I would say that you are better of ensuring you have a usable development environment and then you can use the latest versions of the tools and ensure they are compiled with optimal performance for your system.
... or lua that works the same with golly?
Again, which script are you trying to run? While Golly seems to be slowly moving towards primarily lua support, there's a lot more Golly scripts available in Python as well as a lot of libraries already easily available for Python too.

If you post more details you might also get some help to fix Python support for Golly, which is a much better option than trying to find lua versions of existing Golly scripts.

Re: Thread for your script-related questions

Posted: March 16th, 2020, 3:36 am
by wildmyron
Hunting wrote: March 16th, 2020, 3:13 am Is there any Golly script around that finds methuselahs?
There is no fullly featured dedicated methuselah finding Golly script that I am aware of. This post by dvgrn is probably still relevant.

Other relevant threads:
viewtopic.php?p=47670#p47670
https://conwaylife.com/forums/viewtopic ... 784#p80784
https://conwaylife.com/forums/viewtopic.php?f=9&t=3260

Re: Thread for your script-related questions

Posted: March 22nd, 2020, 3:22 am
by Hunting
Help! I'm having trouble using apgsearch!

Code: Select all

Peer-reviewing hauls:

Internet does not exist; henceforth trying catagolue.appspot.com instead of gol.hatsya.co.uk...
No response!
Authentication failed.
Received no response from /verify.

Peer-review complete; proceeding search.

Re: Thread for your script-related questions

Posted: April 18th, 2020, 10:37 am
by LaundryPizza03
Which programs can find photons with period greater than 1? Particularly ones like this that are too big for LLS.

Code: Select all

#C Matthias Merzenich, 2011
x = 26, y = 31, rule = B2/S13678
7b3o6b3o$o6b4o4b4o6bo$3bo2bo12bo2bo$4o2b2o3b4o3b2o2b4o$b2o4bo4b2o4bo4b
2o$11bo2bo$9bobo2bobo$10bo4bo$9bo2b2o2bo$11bo2bo$8b2o6b2o2$3bo2bo12bo
2bo$7bo4b2o4bo2$bo4bo12bo4bo$4bobobo8bobobo$6bo12bo$3bo2bo12bo2bo$4bo
6bo2bo6bo$6bo12bo$6bo3bob2obo3bo$6b3o8b3o$6b3obo4bob3o2$5b4o8b4o$3b2ob
2o4b2o4b2ob2o$3b2o16b2o2$3b2o16b2o$3b2o16b2o!
If it can support non-totalistic rules, that would be great, too, but not yet necessary. (I'm trying to find a p3 photon in B25/S136.)

Re: Thread for your script-related questions

Posted: April 18th, 2020, 10:44 am
by praosylen
LaundryPizza03 wrote: April 18th, 2020, 10:37 am Which programs can find photons with period greater than 1? Particularly ones like this that are too big for LLS.

Code: Select all

rle
If it can support non-totalistic rules, that would be great, too, but not yet necessary. (I'm trying to find a p3 photon in B25/S136.)
WLS and JLS are probably the best programs available for this kind of search, although neither of them support INT rules. For INT rules, rlifesrc seems to work, but is quite a bit slower.

Re: Thread for your script-related questions

Posted: April 18th, 2020, 11:25 am
by Hunting
A for awesome wrote: April 18th, 2020, 10:44 am
LaundryPizza03 wrote: April 18th, 2020, 10:37 am Which programs can find photons with period greater than 1? Particularly ones like this that are too big for LLS.

Code: Select all

rle
If it can support non-totalistic rules, that would be great, too, but not yet necessary. (I'm trying to find a p3 photon in B25/S136.)
WLS and JLS are probably the best programs available for this kind of search, although neither of them support INT rules. For INT rules, rlifesrc seems to work, but is quite a bit slower.
Not only a bit slower, but also returns p1 photons that is pretty annoying.

There's no p3 photons in B25/S136 that fits in a 20x20 bounding box though.

Re: Thread for your script-related questions

Posted: April 18th, 2020, 5:21 pm
by EvinZL
What is the exact format that golly's g.getclip() outputs in?
Lua and python please
I want python because my programming native language is python
I want lua because I don't want to install python 2

Re: Thread for your script-related questions

Posted: April 19th, 2020, 1:02 am
by otismo
could a script be made to transpose blockic seeds so they could be printed by GilGil's printer ?

could the printers be modified ?

is it possible ?

Re: Thread for your script-related questions

Posted: April 19th, 2020, 5:29 am
by dvgrn
otismo wrote: April 19th, 2020, 1:02 amcould a script be made to transpose blockic seeds so they could be printed by GilGil's printer ?

could the printers be modified ?

is it possible ?
Sort of possible, but not really. We could build printers that take an expanded Blockic pattern and shrink them down during the print process, to reduce the spacing between them to the point where they will function as Blockic seed constellations for arbitrary objects.

There are several large new problems to solve to do that, though. By the time the "modifications" have been done, the printers will basically be completely different from any existing printer.

Re: Thread for your script-related questions

Posted: April 19th, 2020, 6:29 am
by dvgrn
EvinZL wrote: April 18th, 2020, 5:21 pm What is the exact format that golly's g.getclip() outputs in?
Lua and python please
I want python because my programming native language is python
I want lua because I don't want to install python 2
"Exact format" depends on whether the pattern that has previously been copied to the clipboard is two-state or multistate. It's also significantly different between Lua and Python. Python sample code:

Code: Select all

import golly as g
r = g.getrect()
g.select(r)
g.copy()
clip = g.getclip()
g.setclipstr(str(clip))
Lua sample code:

Code: Select all

local g = golly()

local r = g.getrect()
g.select(r)
g.copy()
x, y, clip = g.getclip()

local s = ""
for k, v in pairs(clip) do
    s = s .. v .. "," -- concatenate values in key/value pairs
end
s=s:sub(1,string.len(s)-1)

g.setclipstr(x..","..y..",{"..s.."}")
For example, this pattern

Code: Select all

x = 4, y = 5, rule = B3/S23
bo$2bo$3o2$3bo!
produces

Code: Select all

Python:
[4, 5, 1, 0, 2, 1, 0, 2, 1, 2, 2, 2, 3, 4]
Lua:
4,5,{1,0,2,1,0,2,1,2,2,2,3,4}
But this pattern

Code: Select all

x = 4, y = 5, rule = LifeHistory
.A$2.A$3A2$3.C!
produces

Code: Select all

Python:
[4, 5, 1, 0, 1, 2, 1, 1, 0, 2, 1, 1, 2, 1, 2, 2, 1, 3, 4, 3, 0]
Lua:
4,5,{1,0,1,2,1,1,0,2,1,1,2,1,2,2,1,3,4,3,0}
Notice the zero at the end of these lists. Golly always pads even-length multistate cell lists with zeroes, to make the total length an odd number. That's the only way you can reliably tell a two-state cell list from a multi-state cell list.

Summary, and Major Caveat
Python returns a simple list with the x and y values as the first two elements in the list. Lua returns three parameters: x, y, and then a separate cell list.

A two-state pattern returns a two-state cell list (coordinates in pairs) where a multistate pattern returns triplets specifying each x, y, and state value.

Having said all of this ... until today, I've never once used g.getclip() (!). It's generally much cleaner to just use g.getcells(r) and not get the clipboard involved at all.

Re: Thread for your script-related questions

Posted: April 21st, 2020, 8:38 am
by lemon41625
How would I go about writing a script to detect and identify period and speed of patterns such as rakes, puffers, breeders and replicators?

Re: Thread for your script-related questions

Posted: April 21st, 2020, 9:10 am
by dvgrn
lemon41625 wrote: April 21st, 2020, 8:38 am How would I go about writing a script to detect and identify period and speed of patterns such as rakes, puffers, breeders and replicators?
Start by deciding whether the detection code in the Python version 1.x of apgsearch is good enough for what you need. It produces some kind of (usually) unique identifier for rakes and puffers, anyway, even though I think it's based on the periodicity of the population rather than the actual pattern, so the pattern's period might be twice the number reported in some cases.

If there were a known workable way to programmatically identify breeders and replicators, it might be included in apgsearch already. As it is these things get dumped into the "zz" and "PATHOLOGICAL" categories. It's a hard problem to get a reliable period out of quadratic-growth things.

You could probably come up with a fairly reliable speed of expansion by recording the rate of expansion of a pattern's bounding box, and finding the period of that, in more or less the same way that apgsearch finds the population increase periodicity. But for anything that produces spaceships that move faster than the generating object in the same direction, that won't tell you anything about the generating object itself, only about the speed of the spaceships.

Re: Thread for your script-related questions

Posted: April 21st, 2020, 10:48 am
by wildmyron
dvgrn wrote: April 21st, 2020, 9:10 am
lemon41625 wrote: April 21st, 2020, 8:38 am How would I go about writing a script to detect and identify period and speed of patterns such as rakes, puffers, breeders and replicators?
Start by deciding whether the detection code in the Python version 1.x of apgsearch is good enough for what you need. It produces some kind of (usually) unique identifier for rakes and puffers, anyway, even though I think it's based on the periodicity of the population rather than the actual pattern, so the pattern's period might be twice the number reported in some cases.
Specifically it's the linearlyse function which detects and analyses periodic growth patterns. It can be readily incorporated into other search and CA programs, you can see another example of it's usage in a script I wrote to search for linear growth (It's suboptimal in many ways but hopefully useful to see how it can be used) https://drive.google.com/open?id=1ay2xW ... BPL3RP2ecy

Once you have the period you can determine the speed of puffers by analysing the way their bounding box grows, but as dvgrn says it's trickier to work out what's going on when there are rakes involved.

Here are some comments I wrote about the ideas for the script which may also be useful:
wildmyron wrote: October 31st, 2017, 12:20 am Alternatively the search could just look for linear growth of any kind. I haven't attempted something like this because I haven't really had a strong desire to find any particular category of linear growth. It seems to me that there are several design considerations in doing this to give a program which does something that apgsearch doesn't already do. First off, what is the search space? How do you want to constrain the search so that explosive rules don't bog it down, but the search will still find interesting results. Then you have to determine the method to detect linear growth when it happens. One option for this is readily available - the linearlyse() function from apgsearch (along with the deepperiod() function).

It's certainly possible to cobble together a script which will find something, even if it isn't particularly performant. Here's a brief outline:
  • set up the search paramaters
    • candidate pattern (or patterns)
    • candidate rule (or rulespace)
    • test run parameters (how long to run pattern, max period, etc.)
  • inside a loop:
    • Initialise layer with candidate rule and pattern
    • run pattern for fixed gen
    • call linearlyse()
    • test the return value - if it starts with 'y' then break out of the loop
  • restore layer to state with initial pattern and rule which resulted in linear growth
Btw, I really like your work on CAViewer, I just haven't taken the time to have a good look at it yet and so I haven't responded to your thread.

Re: Thread for your script-related questions

Posted: April 22nd, 2020, 1:15 am
by creeperman7002
Is the "Turmites!" Java program available for the public? I couldn't find it anywhere. If so, where is it?

Here is a screenshot, showing binary counters in the rule {{{1,4,0}, {2,1,0}, {3,1,0}, {2,2,0}}}.
http://gollygang.github.io/ruletablerep ... rspots.jpg

Re: Thread for your script-related questions

Posted: April 29th, 2020, 10:25 am
by lemon41625
Given a transition func for a cellular automaton rule depending on its neighbours (can be adjusted), what is the most efficient algorithm that can be used to simulate it? Can algorithms like QuickLife be used?

Re: Thread for your script-related questions

Posted: June 10th, 2020, 2:10 pm
by toroidalet
Can someone explain these parts of chromacube.cpp? I'm not sure what they're doing.

Code: Select all

    uint64_t backdrop[49] = {};

    for (int i = 0; i < 512; i++) {

        uint8_t a = currstack[(i & 3) | ((i >> 1) & 12)];
        uint8_t b = currstack[((i >> 1) & 3) | ((i >> 2) & 12)];
        uint8_t c = currstack[((i >> 3) & 3) | ((i >> 4) & 12)];
        uint8_t d = currstack[((i >> 4) & 3) | ((i >> 5) & 12)];

        backdrop[7*a + b] |= (1ull << (7*c + d));

    }

Code: Select all

            bool invalid = false;

            invalid = invalid || ((focus & 1) && (currstack[focus] == currstack[focus - 1]));
            invalid = invalid || ((focus & 2) && (currstack[focus] == currstack[focus - 2]));
            invalid = invalid || ((focus & 4) && (currstack[focus] == currstack[focus - 4]));
            invalid = invalid || ((focus & 8) && (currstack[focus] == currstack[focus - 8]));

Re: Thread for your script-related questions

Posted: August 7th, 2020, 1:31 am
by lemon41625
Can someone explain how gfind's state space works on page 7 of Searching for Spaceships?

I don't quite understand it.

https://arxiv.org/pdf/cs/0004003.pdf

Re: Thread for your script-related questions

Posted: August 13th, 2020, 12:36 pm
by wwei23
How can I separate JLS search results (JLS loves its pseudo-objects and constellations)? Usually I use a hacked apgsearch script to open the files as a soup, and let apgsearch separate them, then quit after processing that one "soup". However, this time, apgsearch seems to be unable to do anything, instead it gets stuck coalescing objects. Any help?
EDIT: Never mind. I split the file into four smaller RLEs and now apgsearch is perfectly fine.

Re: Thread for your script-related questions

Posted: October 1st, 2020, 11:55 pm
by yujh
this is switch engine

Code: Select all

se = [0,0,0,1,0,2,1,1,1,4,2,5,3,2,3,4]
, but what is this?

Code: Select all

x = 22, y = 22, rule = B/S012345678
bo18bo$ob18obo$bo18bo$bo18bo$bo18bo$bo18bo$bo18bo$bo18bo$bo18bo$bo18bo
$bo18bo$bo18bo$bo18bo$bo18bo$bo18bo$bo18bo$bo18bo$bo18bo$bo18bo$bo18bo
$ob18obo$bo18bo!
=-->[?]
What about

Code: Select all

x = 23, y = 23, rule = B/S012345678
bo19bo$ob19obo$bo19bo$bo19bo$bo19bo$bo19bo$bo19bo$bo19bo$bo19bo$bo19b
o$bo19bo$bo19bo$bo19bo$bo19bo$bo19bo$bo19bo$bo19bo$bo19bo$bo19bo$bo19b
o$bo19bo$ob19obo$bo19bo!
?
Edit:solved

Re: Thread for your script-related questions

Posted: October 7th, 2020, 6:09 pm
by wwei23
Is there a script to automatically determine the minrule and maxrule of any evolution sequence and not just an oscillator or spaceship? I'm tired of having to manually find said rules so that I can filter them out.

Re: Thread for your script-related questions

Posted: October 7th, 2020, 6:17 pm
by toroidalet

Code: Select all

# Rule computation script for use with Golly.
# Author: Nathaniel Johnston (nathaniel@nathanieljohnston.com), June 2009.
# Updated by: Peter, NASZVADI (), June 2017.

# Gives the maximal family of rules that a still life, oscillator, or spaceship
# works under. Must be called while the rule is set of one such family
# For example, to find out what rules a glider works in, first set the rule
# to Life or HighLife, not Seeds.
# Handles nontotalistic rules, too, so it needs Golly 2.8 or newer.

import golly as g
from glife import validint
from string import replace

Hensel = [
    ['0'],
    ['1c', '1e'],
    ['2a', '2c', '2e', '2i', '2k', '2n'],
    ['3a', '3c', '3e', '3i', '3j', '3k', '3n', '3q', '3r', '3y'],
    ['4a', '4c', '4e', '4i', '4j', '4k', '4n', '4q', '4r', '4t', '4w', '4y', '4z'],
    ['5a', '5c', '5e', '5i', '5j', '5k', '5n', '5q', '5r', '5y'],
    ['6a', '6c', '6e', '6i', '6k', '6n'],
    ['7c', '7e'],
    ['8']
]

# Python versions < 2.4 don't have "sorted" built-in
try:
    sorted
except NameError:
    def sorted(inlist):
        outlist = list(inlist)
        outlist.sort()
        return outlist

# --------------------------------------------------------------------

def chunks(l, n):
    for i in range(0, len(l), n):
        yield l[i:i+n]

# --------------------------------------------------------------------

def rulestringopt(a):
    result = ''
    context = ''
    lastnum = ''
    lastcontext = ''
    for i in a:
        if i in 'BS':
            context = i
            result += i
        elif i in '012345678':
            if (i == lastnum) and (lastcontext == context):
                pass
            else:
                lastcontext = context
                lastnum = i
                result += i
        else:
            result += i
    result = replace(result, '4aceijknqrtwyz', '4')
    result = replace(result, '3aceijknqry', '3')
    result = replace(result, '5aceijknqry', '5')
    result = replace(result, '2aceikn', '2')
    result = replace(result, '6aceikn', '6')
    result = replace(result, '1ce', '1')
    result = replace(result, '7ce', '7')
    return result

clist = []
rule = g.getrule().split(':')[0]

fuzzer = rule + '9'
oldrule = rule
rule = ''
context = ''
deletefrom = []
for i in fuzzer:
    if i == '-':
        deletefrom = [x[1] for x in Hensel[int(context)]]
    elif i in '0123456789/S':
        if deletefrom:
            rule += ''.join(deletefrom)
            deletefrom = []
        context = i
    if len(deletefrom) == 0:
        rule += i
    elif i in deletefrom:
        deletefrom.remove(i)
rule = rule.strip('9')

if not (rule[0] == 'B' and '/S' in rule):
    g.exit('Please set Golly to a Life-like rule.')

if g.empty():
    g.exit('The pattern is empty.')

s = g.getstring('Enter the period:', '', 'Rules calculator')
if not validint(s):
    g.exit('Bad number: %s' % s)

numsteps = int(s)
if numsteps < 1:
    g.exit('Period must be at least 1.')

g.select(g.getrect())
g.copy()
s = int(s)

for i in range(0,s):
    g.run(1)
    clist.append(list(chunks(g.getcells(g.getrect()), 2)))
    mcc = min(clist[i])
    clist[i] = [[x[0] - mcc[0], x[1] - mcc[1]] for x in clist[i]]

g.show('Processing...')

ruleArr = rule.split('/')
ruleArr[0] = ruleArr[0].lstrip('B')
ruleArr[1] = ruleArr[1].lstrip('S')

b_need = []
b_OK = []
s_need = []
s_OK = []

context = ''
fuzzed = ruleArr[0] + '9'
for i in fuzzed:
    if i in '0123456789':
        if len(context) == 1:
            b_need += Hensel[int(context)]
            b_OK += Hensel[int(context)]
        context = i
    elif context != '':
        b_need.append(context[0] + i)
        b_OK.append(context[0] + i)
        context += context[0]
context = ''
fuzzed = ruleArr[1] + '9'
for i in fuzzed:
    if i in '0123456789':
        if len(context) == 1:
            s_need += Hensel[int(context)]
            s_OK += Hensel[int(context)]
        context = i
    elif context != '':
        s_need.append(context[0] + i)
        s_OK.append(context[0] + i)
        context += context[0]

for i in [iter2 for iter1 in Hensel for iter2 in iter1]:
    if not i in b_OK:
        b_OK.append(i)
        execfor = 1
        # B0 and nontotalistic rulestrings are mutually exclusive
        try:
            g.setrule(rulestringopt('B' + ''.join(b_OK) + '/S' + ruleArr[1]))
        except:
            b_OK.remove(i)
            execfor = 0
        for j in range(0, s * execfor):
            g.run(1)
            try:
                dlist = list(chunks(g.getcells(g.getrect()), 2))
                mcc = min(dlist)
                dlist = [[x[0] - mcc[0], x[1] - mcc[1]] for x in dlist]
                if not(clist[j] == dlist):
                    b_OK.remove(i)
                    break
            except:
                b_OK.remove(i)
                break
        g.new('')
        g.paste(0, 0, 'or')
        g.select(g.getrect())
        b_OK.sort()

    if not i in s_OK:
        s_OK.append(i)
        execfor = 1
        # B0 and nontotalistic rulestrings are mutually exclusive
        try:
            g.setrule(rulestringopt('B' + ruleArr[0] + '/S' + ''.join(s_OK)))
        except:
            s_OK.remove(i)
            execfor = 0
        for j in range(0, s * execfor):
            g.run(1)
            try:
                dlist = list(chunks(g.getcells(g.getrect()), 2))
                mcc = min(dlist)
                dlist = [[x[0] - mcc[0], x[1] - mcc[1]] for x in dlist]
                if not(clist[j] == dlist):
                    s_OK.remove(i)
                    break
            except:
                s_OK.remove(i)
                break
        g.new('')
        g.paste(0, 0, 'or')
        g.select(g.getrect())
        s_OK.sort()

    if i in b_need:
        b_need.remove(i)
        g.setrule(rulestringopt('B' + ''.join(b_need) + '/S' + ruleArr[1]))
        for j in range(0, s):
            g.run(1)
            try:
                dlist = list(chunks(g.getcells(g.getrect()), 2))
                mcc = min(dlist)
                dlist = [[x[0] - mcc[0], x[1] - mcc[1]] for x in dlist]
                if not(clist[j] == dlist):
                    b_need.append(i)
                    break
            except:
                b_need.append(i)
                break
        g.new('')
        g.paste(0, 0, 'or')
        g.select(g.getrect())
        b_need.sort()

    if i in s_need:
        s_need.remove(i)
        g.setrule(rulestringopt('B' + ruleArr[0] + '/S' + ''.join(s_need)))
        for j in range(0, s):
            g.run(1)
            try:
                dlist = list(chunks(g.getcells(g.getrect()), 2))
                mcc = min(dlist)
                dlist = [[x[0] - mcc[0], x[1] - mcc[1]] for x in dlist]
                if not(clist[j] == dlist):
                    s_need.append(i)
                    break
            except:
                s_need.append(i)
                break
        g.new('')
        g.paste(0, 0, 'or')
        g.select(g.getrect())
        s_need.sort()

g.setrule(oldrule)
ruleres = 'B' + ''.join(sorted(b_need)) + '/S' + ''.join(sorted(s_need)) + \
    ' - B' + ''.join(sorted(b_OK)) + '/S' + ''.join(sorted(s_OK))
ruleres = rulestringopt(ruleres)
g.show(ruleres)
EDIT by dvgrn: A version of this script that works in Golly 4.0/Python 3 is available here under the name 'isorule.py'.

Re: Thread for your script-related questions

Posted: October 7th, 2020, 6:20 pm
by wwei23
toroidalet wrote: October 7th, 2020, 6:17 pm

Code: Select all

script
I'm not sure if that works with replicators.

Re: Thread for your script-related questions

Posted: October 7th, 2020, 6:21 pm
by toroidalet
You input a number of generations and it gives you a list of rules that the sequence works in (not an LLS partial rule). It works with any pattern whatsoever.

Re: Thread for your script-related questions

Posted: October 12th, 2020, 11:19 am
by wwei23
Love that program. Makes replicator analysis and filtering so much easier.
If I write my own search program, can I add it to the LifeWiki search programs page?