Page 5 of 27

Re: Thread for your script-related questions

Posted: December 4th, 2020, 8:54 pm
by yujh

Code: Select all

def canonise(duration):

    representation = "#"

    # We need to compare each phase to find the one with the smallest
    # description:
    for t in xrange(duration):

        rect = g.getrect()
        if (len(rect) == 0):
            return "0"

        if ((rect[2] <= 40) & (rect[3] <= 40)):
            # Fits within a 40-by-40 bounding box, so eligible to be canonised.
            # Choose the orientation which results in the smallest description:
            representation = compare_representations(representation, canonise_orientation(rect[2], rect[3], rect[0], rect[1], 1, 0, 0, 1))
            representation = compare_representations(representation, canonise_orientation(rect[2], rect[3], rect[0]+rect[2]-1, rect[1], -1, 0, 0, 1))
            representation = compare_representations(representation, canonise_orientation(rect[2], rect[3], rect[0], rect[1]+rect[3]-1, 1, 0, 0, -1))
            representation = compare_representations(representation, canonise_orientation(rect[2], rect[3], rect[0]+rect[2]-1, rect[1]+rect[3]-1, -1, 0, 0, -1))
            representation = compare_representations(representation, canonise_orientation(rect[3], rect[2], rect[0], rect[1], 0, 1, 1, 0))
            representation = compare_representations(representation, canonise_orientation(rect[3], rect[2], rect[0]+rect[2]-1, rect[1], 0, -1, 1, 0))
            representation = compare_representations(representation, canonise_orientation(rect[3], rect[2], rect[0], rect[1]+rect[3]-1, 0, 1, -1, 0))
            representation = compare_representations(representation, canonise_orientation(rect[3], rect[2], rect[0]+rect[2]-1, rect[1]+rect[3]-1, 0, -1, -1, 0))

        g.run(1)

    return representation

# A subroutine used by canonise:
def canonise_orientation(length, breadth, ox, oy, a, b, c, d):

    representation = ""

    chars = "0123456789abcdefghijklmnopqrstuvwxyz"

    for v in xrange(int((breadth-1)/5)+1):
        zeroes = 0
        if (v != 0):
            representation += "z"
        for u in xrange(length):
            baudot = 0
            for w in xrange(5):
                x = ox + a*u + b*(5*v + w)
                y = oy + c*u + d*(5*v + w)
                baudot = (baudot >> 1) + 16*g.getcell(x, y)
            if (baudot == 0):
                zeroes += 1
            else:
                if (zeroes > 0):
                    if (zeroes == 1):
                        representation += "0"
                    elif (zeroes == 2):
                        representation += "w"
                    elif (zeroes == 3):
                        representation += "x"
                    else:
                        representation += "y"
                        representation += chars[zeroes - 4]
                zeroes = 0
                representation += chars[baudot]
    return representation
Is there a way to get apgcodes of bigger natural objects, like 100*100?(sometimes it kills the search)

Re: Thread for your script-related questions

Posted: December 4th, 2020, 9:51 pm
by Hunting
yujh wrote: December 4th, 2020, 8:54 pm Is there a way to get apgcodes of bigger natural objects, like 100*100?(sometimes it kills the search)
There are no apgcodes for 100*100 objects.

Re: Thread for your script-related questions

Posted: December 4th, 2020, 10:49 pm
by Ian07
yujh wrote: December 4th, 2020, 8:54 pm Is there a way to get apgcodes of bigger natural objects, like 100*100?(sometimes it kills the search)
Here's a script for finding "greedy" apgcodes; is this what you're looking for?

Code: Select all

import golly as g
import webbrowser

# Golly selection to apgcode (in clipboard)
# stolen shamelessly from apgsearch.  Thanks Adam!

def bijoscar(maxsteps):

    initpop = int(g.getpop())
    initrect = g.getrect()
    if (len(initrect) == 0):
        return 0
    inithash = g.hash(initrect)

    for i in range(maxsteps):

        g.run(1)

        if (int(g.getpop()) == initpop):

            prect = g.getrect()
            phash = g.hash(prect)

            if (phash == inithash):

                period = i + 1

                if (prect == initrect):
                    return period
                else:
                    return -period
    return -1


def canonise():
   
    p = bijoscar(1000000)

    representation = "#"
    for i in range(abs(p)):
        rect = g.getrect()
        representation = compare_representations(representation, canonise_orientation(rect[2], rect[3], rect[0], rect[1], 1, 0, 0, 1))
        representation = compare_representations(representation, canonise_orientation(rect[2], rect[3], rect[0]+rect[2]-1, rect[1], -1, 0, 0, 1))
        representation = compare_representations(representation, canonise_orientation(rect[2], rect[3], rect[0], rect[1]+rect[3]-1, 1, 0, 0, -1))
        representation = compare_representations(representation, canonise_orientation(rect[2], rect[3], rect[0]+rect[2]-1, rect[1]+rect[3]-1, -1, 0, 0, -1))
        representation = compare_representations(representation, canonise_orientation(rect[3], rect[2], rect[0], rect[1], 0, 1, 1, 0))
        representation = compare_representations(representation, canonise_orientation(rect[3], rect[2], rect[0]+rect[2]-1, rect[1], 0, -1, 1, 0))
        representation = compare_representations(representation, canonise_orientation(rect[3], rect[2], rect[0], rect[1]+rect[3]-1, 0, 1, -1, 0))
        representation = compare_representations(representation, canonise_orientation(rect[3], rect[2], rect[0]+rect[2]-1, rect[1]+rect[3]-1, 0, -1, -1, 0))
        g.run(1)
   
    if (p<0):
        prefix = "q"+str(abs(p))
    elif (p==1):
        prefix = "s"+str(g.getpop())
    else:
        prefix = "p"+str(p)

    rule = str.replace(g.getrule(),"/","").lower()
   
    webbrowser.open_new("https://catagolue.hatsya.com/object/x"+prefix+"_"+representation+"/"+rule)

# A subroutine used by canonise:
def canonise_orientation(length, breadth, ox, oy, a, b, c, d):

    representation = ""

    chars = "0123456789abcdefghijklmnopqrstuvwxyz"

    for v in range(int((breadth-1)/5)+1):
        zeroes = 0
        if (v != 0):
            representation += "z"
        for u in range(length):
            baudot = 0
            for w in range(5):
                x = ox + a*u + b*(5*v + w)
                y = oy + c*u + d*(5*v + w)
                baudot = (baudot >> 1) + 16*g.getcell(x, y)
            if (baudot == 0):
                zeroes += 1
            else:
                while zeroes > 0:
                    if (zeroes == 1):
                        representation += "0"
                    elif (zeroes == 2):
                        representation += "w"
                    elif (zeroes == 3):
                        representation += "x"
                    elif (zeroes > 39):
                        representation += "yz"
                    else:
                        representation += "y"
                        representation += chars[zeroes - 4]
                    zeroes -= 39
                zeroes = 0
                representation += chars[baudot]
    return representation

# Compares strings first by length, then by lexicographical ordering.
# A hash character is worse than anything else.
def compare_representations(a, b):

    if (a == "#"):
        return b
    elif (b == "#"):
        return a
    elif (len(a) < len(b)):
        return a
    elif (len(b) < len(a)):
        return b
    elif (a < b):
        return a
    else:
        return b

g.duplicate()
g.clear(1)
canonise()

g.dellayer()
Originally from here, with some modifications to work with Python 3.x.
Hunting wrote: December 4th, 2020, 9:51 pm There are no apgcodes for 100*100 objects.
You sure about that?

Re: Thread for your script-related questions

Posted: December 5th, 2020, 9:38 am
by otismo
I would like a script that makes a Loafer Bitmap Printer

out of this memory register, which uses P46 technology
P322MEMtape-G-to-L-Converter-with-P322gun-NOT.rle
p46 tech xcept 4 snarking around to kill loafers
(24.77 KiB) Downloaded 227 times
is this possible?

@ anybody?

Thank You !

Cheers !

Re: Thread for your script-related questions

Posted: December 9th, 2020, 9:21 pm
by creeperman7002
How can I prevent JLS from outputting solutions with non-interacting cells?

Re: Thread for your script-related questions

Posted: December 10th, 2020, 1:11 am
by wwei23
creeperman7002 wrote: December 9th, 2020, 9:21 pm How can I prevent JLS from outputting solutions with non-interacting cells?
Examples? :P

Re: Thread for your script-related questions

Posted: December 10th, 2020, 5:54 am
by wildmyron
creeperman7002 wrote: December 9th, 2020, 9:21 pm How can I prevent JLS from outputting solutions with non-interacting cells?
This is not something JLS is capable of doing automatically. The best you could do is manually divide the search and set cells in ways that either force an area off or cause it to interact with the existing partials.

If you have use Windows you could try Nicolau Beluchenko's version of WLS. It has options to detect non-interacting solutions and then backtrack when they are found again. This greatly improves search speed for those searches where non-interacting solutions are a problem. https://conwaylife.com/forums/viewtopic ... 433#p98433

Re: Thread for your script-related questions

Posted: December 13th, 2020, 1:44 pm
by volcanrb
Are there any search programs capable of searching for spaceships in chaotic LTL rules that don't necessarily stabilize?

Specifically, I want to search for diagonal spaceships in the rule R2,C0,S4,B4. It's a very interesting rule with a number of common orthogonal spaceships, however there is one somewhat common pattern which causes chaotic exploding behaviour. In any large enough soup, the pattern will almost definitely show up, ensuring the soup doesn't stabilize. I tried running apgsearch on this rule, and the program seemed to just freeze immediately and never outputted anything, I assume because of the non-stabilizing behaviour of the rule.

Is there some program that could handle searching such a non-stabilizing LTL rule?

Re: Thread for your script-related questions

Posted: December 13th, 2020, 8:36 pm
by Hunting
volcanrb wrote: December 13th, 2020, 1:44 pm Are there any search programs capable of searching for spaceships in chaotic LTL rules that don't necessarily stabilize?

Specifically, I want to search for diagonal spaceships in the rule R2,C0,S4,B4. It's a very interesting rule with a number of common orthogonal spaceships, however there is one somewhat common pattern which causes chaotic exploding behaviour. In any large enough soup, the pattern will almost definitely show up, ensuring the soup doesn't stabilize. I tried running apgsearch on this rule, and the program seemed to just freeze immediately and never outputted anything, I assume because of the non-stabilizing behaviour of the rule.

Is there some program that could handle searching such a non-stabilizing LTL rule?
PlutoniumSearch can, but let me clean up the code first.

(Sry for selfpromoting, but I can't think of any other search program that supports LTL offhand.)

Re: Thread for your script-related questions

Posted: December 13th, 2020, 11:35 pm
by lemon41625
volcanrb wrote: December 13th, 2020, 1:44 pm Are there any search programs capable of searching for spaceships in chaotic LTL rules that don't necessarily stabilize?

Specifically, I want to search for diagonal spaceships in the rule R2,C0,S4,B4. It's a very interesting rule with a number of common orthogonal spaceships, however there is one somewhat common pattern which causes chaotic exploding behaviour. In any large enough soup, the pattern will almost definitely show up, ensuring the soup doesn't stabilize. I tried running apgsearch on this rule, and the program seemed to just freeze immediately and never outputted anything, I assume because of the non-stabilizing behaviour of the rule.

Is there some program that could handle searching such a non-stabilizing LTL rule?
Yes, that would be Logic Cellular Automaton Search (LCAS).

See viewtopic.php?f=9&t=4569 and follow the instructions to set it up.

Re: Thread for your script-related questions

Posted: December 26th, 2020, 7:11 pm
by HelicopterCat3
I recently got python 3.9 and 2.7.13 and when I tried to run apgsearch it came up with this error message:

I don't know if this is a script problem or a python/Golly problem

Re: Thread for your script-related questions

Posted: December 26th, 2020, 7:41 pm
by goldenratio
HelicopterCat3 wrote: December 26th, 2020, 7:11 pm I recently got python 3.9 and 2.7.13 and when I tried to run apgsearch it came up with this error message:
Don't know but you should be better off running the much faster 5.x version of apgsearch, considering you'll need to know how to use the terminal anyways if you want to use gfind (which is currently very user-unfriendly for INT afaik just to warn you, ntzfind/qfind/ikpx2 are better options but I'm probably not the best person to ask about this sort of thing).

Re: Thread for your script-related questions

Posted: December 26th, 2020, 8:12 pm
by HelicopterCat3
goldenratio wrote: December 26th, 2020, 7:41 pm Don't know but you should be better off running the much faster 5.x version of apgsearch, considering you'll need to know how to use the terminal anyways if you want to use gfind (which is currently very user-unfriendly for INT afaik just to warn you, ntzfind/qfind/ikpx2 are better options but I'm probably not the best person to ask about this sort of thing).
What kind of features does qfind have? What does it need to function?
I'll consider getting 5.x then. The tutorial on the wiki said to use the hacked one for INT rules, so I did that.

Re: Thread for your script-related questions

Posted: December 27th, 2020, 12:10 am
by bubblegum
HelicopterCat3 wrote: December 26th, 2020, 8:12 pm I'll consider getting 5.x then. The tutorial on the wiki said to use the hacked one for INT rules, so I did that.
Aidan's hacked apgsearch 1.x is for apgsearch 1.x, apgsearch 5.x has built-in support for INT.

Wow, the tutorials are outdated.

Re: Thread for your script-related questions

Posted: December 27th, 2020, 2:24 am
by yujh
I think they are probably trying to use apgsearch but with golly 4.0?

(Hacked versions only work with python 2.x if nobody wants to update them)

Re: Thread for your script-related questions

Posted: December 30th, 2020, 3:01 pm
by HelicopterCat3
Funny story, that error message I received shows up for any script I "execute" so I think my python library is incomplete somehow. I tried to uninstall and reinstall python but came up with the same message. I don't think I'm gonna be using scripts for a while until I can figure out what's going on.
If you all have any advice, please share it

Re: Thread for your script-related questions

Posted: December 30th, 2020, 7:43 pm
by bubblegum
HelicopterCat3 wrote: December 30th, 2020, 3:01 pm Funny story, that error message I received shows up for any script I "execute" so I think my python library is incomplete somehow. I tried to uninstall and reinstall python but came up with the same message. I don't think I'm gonna be using scripts for a while until I can figure out what's going on.
If you all have any advice, please share it
It seems that PyModule_Create2() is part of the C API. Either:
1) you have a debug version which will include a different symbol, or
2) (more likely) you're trying to use Python 2.x with Golly 4.x (these are incompatible), PyModule_Create2() is new in Python 3.1.

Re: Thread for your script-related questions

Posted: December 31st, 2020, 1:33 am
by Hunting
bubblegum wrote: December 27th, 2020, 12:10 am
HelicopterCat3 wrote: December 26th, 2020, 8:12 pm I'll consider getting 5.x then. The tutorial on the wiki said to use the hacked one for INT rules, so I did that.
Aidan's hacked apgsearch 1.x is for apgsearch 1.x, apgsearch 5.x has built-in support for INT.

Wow, the tutorials are outdated.
The tutorial is not - it says to use the hacked one for INT rules if you decided to use 1.x, otherwise 5.x. The "INT rules" section is under the 1.x section.

Re: Thread for your script-related questions

Posted: December 31st, 2020, 2:50 am
by bubblegum
Hunting wrote: December 31st, 2020, 1:33 am The tutorial is not - it says to use the hacked one for INT rules if you decided to use 1.x, otherwise 5.x. The "INT rules" section is under the 1.x section.
No, the tutorials in general are outdated, that part (updated recently) is fine.

Re: Thread for your script-related questions

Posted: December 31st, 2020, 5:58 pm
by HelicopterCat3
bubblegum wrote: December 30th, 2020, 7:43 pm
HelicopterCat3 wrote: December 30th, 2020, 3:01 pm Funny story, that error message I received shows up for any script I "execute" so I think my python library is incomplete somehow. I tried to uninstall and reinstall python but came up with the same message. I don't think I'm gonna be using scripts for a while until I can figure out what's going on.
If you all have any advice, please share it
It seems that PyModule_Create2() is part of the C API. Either:
1) you have a debug version which will include a different symbol, or
2) (more likely) you're trying to use Python 2.x with Golly 4.x (these are incompatible), PyModule_Create2() is new in Python 3.1.
Ah ok thank you so much

Edit: A couple of questions,
1. Where do I download apgsearch 5.x?
2. Do I need a unix-like command line for it (I'm on windows) like it says on the wiki?
3. Where do I download qfind or a spaceship searcher like lifesrc?

Re: Thread for your script-related questions

Posted: December 31st, 2020, 8:59 pm
by bubblegum
HelicopterCat3 wrote: December 31st, 2020, 5:58 pm 1. Where do I download apgsearch 5.x?
2. Do I need a unix-like command line for it (I'm on windows) like it says on the wiki?
3. Where do I download qfind or a spaceship searcher like lifesrc?
1) Follow the instructions at https://gitlab.com/apgoucher/apgmera.
2) Yes, try Cygwin64 as mentioned (WSL is probably overkill).
3) Just browse the Scripts subforum until you find one you like (I prefer ikpx2).

EDIT: Oh no.

Code: Select all

b3s23/5Glider_stdin: 6305879 soups completed (inf soups/second current, 405.126 overall).

Re: Thread for your script-related questions

Posted: January 1st, 2021, 6:31 am
by Hunting
bubblegum wrote: December 31st, 2020, 8:59 pm 2) Yes, try Cygwin64 as mentioned (WSL is probably overkill).
WSL is a built-in tool while Cygwin requires a lot of installation and so on, I never figured out how to install it. So no, use WSL.

Re: Thread for your script-related questions

Posted: January 1st, 2021, 5:26 pm
by bubblegum
Hunting wrote: January 1st, 2021, 6:31 am WSL is a built-in tool while Cygwin requires a lot of installation and so on, I never figured out how to install it. So no, use WSL.
How about this: use whatever you want.

Re: Thread for your script-related questions

Posted: January 2nd, 2021, 7:43 am
by Scorbie
HelicopterCat3 wrote: December 31st, 2020, 5:58 pm 3. Where do I download qfind or a spaceship searcher like lifesrc?
Some programs can be found in LifeWiki. (e.g. lifesrc)

Re: Thread for your script-related questions

Posted: January 7th, 2021, 9:39 pm
by HelicopterCat3
bubblegum wrote: December 31st, 2020, 8:59 pm
HelicopterCat3 wrote: December 31st, 2020, 5:58 pm 1. Where do I download apgsearch 5.x?
2. Do I need a unix-like command line for it (I'm on windows) like it says on the wiki?
3. Where do I download qfind or a spaceship searcher like lifesrc?
1) Follow the instructions at https://gitlab.com/apgoucher/apgmera.
2) Yes, try Cygwin64 as mentioned (WSL is probably overkill).
3) Just browse the Scripts subforum until you find one you like (I prefer ikpx2).

EDIT: Oh no.

Code: Select all

b3s23/5Glider_stdin: 6305879 soups completed (inf soups/second current, 405.126 overall).
I'm sorry I have one last question. What do you recommend as a good c++ compiler? Or does WSL/Cygwin come with a c++ compiler built in?