Thread for your script-related questions

For scripts to aid with computation or simulation in cellular automata.
GUYTU6J
Posts: 2200
Joined: August 5th, 2016, 10:27 am
Location: 拆哪!I repeat, CHINA! (a.k.a. 种花家)
Contact:

Re: Thread for your script-related questions

Post by GUYTU6J » October 19th, 2023, 10:19 pm

DaveTree339 wrote:
October 19th, 2023, 10:13 pm
Ok, I do not understand what you mean. I'm trying to follow this tutorial:
https://conwaylife.com/wiki/Tutorials/Y ... hon_script

Are you saying I have to somehow write the script in golly so that the script runs from golly?
The tutorial mentions a python ide window but doesn't elaborate on what it is, I assumed it was just the python window if that's the right name for it.
See the section "Running Golly scripts": the script needs to be moved into a golly folder.

(I usually just use notepad instead of IDE and write scripts inside a "Local" folder created under "Scripts".)
EDIT:
DaveTree339 wrote:
October 19th, 2023, 10:41 pm
That makes sense. I saved the script in the notepad then moved the file for the notepad save to a new folder in the scripts folder of golly but when i go to run script in golly i see the new folder i just created but when i open it it says no items match your search so i'm thinking the notepad file might be the wrong filetype or something, how do i change it to be the right file type so golly can see/run it?
The file extension for a python script is .py. Just rename the file with "display file extension" set on.
Last edited by GUYTU6J on October 19th, 2023, 10:58 pm, edited 2 times in total.

DaveTree339
Posts: 5
Joined: December 22nd, 2021, 7:47 pm

Re: Thread for your script-related questions

Post by DaveTree339 » October 19th, 2023, 10:41 pm

That makes sense. I saved the script in the notepad then moved the file for the notepad save to a new folder in the scripts folder of golly but when i go to run script in golly i see the new folder i just created but when i open it it says no items match your search so i'm thinking the notepad file might be the wrong filetype or something, how do i change it to be the right file type so golly can see/run it?

User avatar
dvgrn
Moderator
Posts: 10693
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: Thread for your script-related questions

Post by dvgrn » October 20th, 2023, 9:21 am

DaveTree339 wrote:
October 19th, 2023, 10:13 pm
Ok, I do not understand what you mean. I'm trying to follow this tutorial:
https://conwaylife.com/wiki/Tutorials/Y ... hon_script

Are you saying I have to somehow write the script in golly so that the script runs from golly?
The tutorial mentions a python ide window but doesn't elaborate on what it is, I assumed it was just the python window if that's the right name for it.
That tutorial talks about using a text editor or Python IDE -- the one usually installed with Python is called "IDLE". Using an IDE is "recommended". You get syntax highlighting and some other features that way that can help you find typos and coding errors.

... For what it's worth, I almost never use anything except a plain text editor for Python coding, myself (which may explain why I'm not really a very good programmer once a project moves from the 100-lines-of-code range to the 1000+-lines-of-code range).

Read a little farther in the tutorial and you'll find that it never tells you to actually run your Python script from inside the Python IDE.
Now move your periodfinder.py script to the Scripts folder. (Note: If you want to put your Golly scripts somewhere else, use File>Set File Folder to let Golly read a different file directory.)

Enter Golly (this is important; Golly scripts can only be run within Golly)...
Here again, I never muck around with putting scripts in my Golly scripts folder, unless I've written a new utility that I really want to keep as a standard part of my toolkit. Most of my Python scripts are more "one-off" projects -- I run them once to search for something, measure something, solve a specific problem, and then I'm pretty much done with that script. So there's no point in cluttering up my Scripts folder with the remains of dead projects.

I put most scripts in a newly created folder on my Desktop, and run them from there -- and along the lines of the tutorial's suggestion, I change Golly's default file display location to the Desktop, so that I can see all of my projects. I keep the latest edition of Golly in another folder right there on the Desktop.

That's not intended as a suggestion that you should do the same -- just do whatever works for you. But long story short, you'll never be able to run a Golly script that starts with "import golly as g" with just a regular Python IDE or command line.

User avatar
MEisSCAMMER
Posts: 96
Joined: September 20th, 2022, 5:12 pm
Location: Yes
Contact:

Re: Thread for your script-related questions

Post by MEisSCAMMER » November 10th, 2023, 10:50 pm

dvgrn wrote:
February 1st, 2023, 11:07 am
rutabaga wrote:
February 1st, 2023, 9:58 am
How do you make an animated CGOL pattern as your profile picture? Or do you have to do it as a GIF
I think the usual way is with Scorbie's giffer.py script, but I don't remember the caveats and limitations (if any). If someone can confirm I've got the right link, that would be a good question-and-answer to go in the FAQ. Scorbie's repo, mentioned on the giffer.py error reporting thread, has been removed, and codeholic's repo is definitely very old now.

New versions of Golly now come with giffer.lua, which doesn't need a separate install for the language the way Python does. Again there may be some caveats that would be good to know. There aren't any particular limitations mentioned in the Lua script comments.
One quirk in giffer.lua: cells show up really small—I think 2x2 pixels—in all generated GIFs, and I'm not proficient enough (read: completely incompetent) at Lua to know how to change this. I used this script to create my avatar and it would be nice to know how to make it less tiny?
THE TRILOGY HAS BEEN COMPLETED
next: quadrilogy??? Is that even a word

User avatar
EvinZL
Posts: 854
Joined: November 8th, 2018, 4:15 pm
Location: A tungsten pool travelling towards the sun
Contact:

Re: Thread for your script-related questions

Post by EvinZL » December 5th, 2023, 7:06 pm

MEisSCAMMER wrote:
November 10th, 2023, 10:50 pm
dvgrn wrote:
February 1st, 2023, 11:07 am
I think the usual way is with Scorbie's giffer.py script ...

New versions of Golly now come with giffer.lua, which doesn't need a separate install for the language the way Python does. Again there may be some caveats that would be good to know. There aren't any particular limitations mentioned in the Lua script comments.
One quirk in giffer.lua: cells show up really small—I think 2x2 pixels—in all generated GIFs, and I'm not proficient enough (read: completely incompetent) at Lua to know how to change this. I used this script to create my avatar and it would be nice to know how to make it less tiny?
I believe giffer.py has more customization options than giffer.lua

Disaster16439
Posts: 191
Joined: June 30th, 2023, 9:17 am
Location: Suffocating(my coordinates are 3,-64,192929929)

Re: Thread for your script-related questions

Post by Disaster16439 » December 10th, 2023, 2:47 pm

How do I use Raucci's search program? It doesn't seem to give outputs. Also, is there/can someone create an INT version of JLS(or if you can modify it for b34qs23-k, but a version for all int would be better)? Also, many people say there is no int dr and there is a modified version for leaplife and stuff like that. So can someone create one? Or just a b34qs23-k one would be good.(maybe 2 transitions from outer totalistic rule?) rlifesrc works, but its input system is quite awful. I have to put in rles, and stuff. But with JLS you just need to click on cells
I QUIT CA

hotdogPi
Posts: 1626
Joined: August 12th, 2020, 8:22 pm

Re: Thread for your script-related questions

Post by hotdogPi » December 10th, 2023, 3:21 pm

My search program doesn't output anything. It stops with a warning if it finds something, and then you can click OK to ignore it and continue or Cancel to abort the program and see what you found. Then you can change the start parameters to continue where you left off.
User:HotdogPi/My discoveries

Periods discovered: 5-16,⑱,⑳G,㉑G,㉒㉔㉕,㉗-㉛,㉜SG,㉞㉟㊱㊳㊵㊷㊹㊺㊽㊿,54G,55G,56,57G,60,62-66,68,70,73,74S,75,76S,80,84,88,90,96
100,02S,06,08,10,12,14G,16,17G,20,26G,28,38,47,48,54,56,72,74,80,92,96S
217,486,576

S: SKOP
G: gun

Disaster16439
Posts: 191
Joined: June 30th, 2023, 9:17 am
Location: Suffocating(my coordinates are 3,-64,192929929)

Re: Thread for your script-related questions

Post by Disaster16439 » December 10th, 2023, 4:52 pm

hotdogPi wrote:
December 10th, 2023, 3:21 pm
My search program doesn't output anything. It stops with a warning if it finds something, and then you can click OK to ignore it and continue or Cancel to abort the program and see what you found. Then you can change the start parameters to continue where you left off.
But if I click OK, will I lose that result?
I QUIT CA

hotdogPi
Posts: 1626
Joined: August 12th, 2020, 8:22 pm

Re: Thread for your script-related questions

Post by hotdogPi » December 10th, 2023, 8:33 pm

Disaster16439 wrote:
December 10th, 2023, 4:52 pm
hotdogPi wrote:
December 10th, 2023, 3:21 pm
My search program doesn't output anything. It stops with a warning if it finds something, and then you can click OK to ignore it and continue or Cancel to abort the program and see what you found. Then you can change the start parameters to continue where you left off.
But if I click OK, will I lose that result?
Yes. The labels are unintuitive for the purposes of this program, but it's just how Golly's "warn" feature works. OK is basically "ignore this".
User:HotdogPi/My discoveries

Periods discovered: 5-16,⑱,⑳G,㉑G,㉒㉔㉕,㉗-㉛,㉜SG,㉞㉟㊱㊳㊵㊷㊹㊺㊽㊿,54G,55G,56,57G,60,62-66,68,70,73,74S,75,76S,80,84,88,90,96
100,02S,06,08,10,12,14G,16,17G,20,26G,28,38,47,48,54,56,72,74,80,92,96S
217,486,576

S: SKOP
G: gun

carsoncheng
Posts: 475
Joined: June 11th, 2022, 11:24 pm

Re: Thread for your script-related questions

Post by carsoncheng » December 10th, 2023, 10:30 pm

Disaster16439 wrote:
December 10th, 2023, 4:52 pm
hotdogPi wrote:
December 10th, 2023, 3:21 pm
My search program doesn't output anything. It stops with a warning if it finds something, and then you can click OK to ignore it and continue or Cancel to abort the program and see what you found. Then you can change the start parameters to continue where you left off.
But if I click OK, will I lose that result?
I think it's actually pretty easy to modify it to save all results into a file. Here is the modification (I haven't run it for a long time though):

Code: Select all

import golly as g
import time
#import os
#os.system("pip3 install pyperclip")
g.warn("done")
import pyperclip
'''Initializing'''
g.select([0,0,1,1])
#g.autoupdate(1)
test1 = False
test2 = 0
test2a = 0
mode = 'C2' #C2, C4, D4, X4, D8
spark_mode = 'mwhw'
copies = 8 if mode == 'D8' else 2 if mode == 'C2' else 4
g.new("example")
input_pattern = g.parse('b3o$o3bo$2ob2o!')
g.putcells(input_pattern, 0, 0)
initial_box = g.getrect()
width = g.getrect()[2]
height = g.getrect()[3]
'''Generating rotations and reflections'''
if mode == 'C2':
    r_up = input_pattern
    g.select(initial_box)
    g.rotate(1)
    g.rotate(1)
    g.cut()
    g.paste(0,0,"or")
    r_down = g.getcells(g.getrect())
elif mode in ('C4','X4','D8'):
    a = 0  #1 if even symmetry, 0 if odd; C4 and D8 only
    r_n = input_pattern
    initial_box = g.getrect()
    g.select(initial_box)
    if mode == 'X4':
        g.flip(1)
    g.rotate(mode != 'X4')
    g.select(g.getrect())
    g.cut()
    g.paste(0,0,"or")
    r_e = g.getcells(g.getrect())
    g.select(g.getrect())
    if mode == 'X4':
        g.flip(1)
    g.rotate(1)
    g.cut()
    g.paste(0,0,"or")
    r_s = g.getcells(g.getrect())
    g.select(g.getrect())
    if mode == 'X4':
        g.flip(1)
    g.rotate(mode != 'X4')
    g.cut()
    g.paste(0,0,"or")
    r_w = g.getcells(g.getrect())
    if mode == 'D8':
        g.select(g.getrect())
        g.flip(0)
        g.rotate(1)
        g.rotate(1)
        g.cut()
        g.paste(0,0,"or")
        r_nw = g.getcells(g.getrect())
        g.select(g.getrect())
        g.rotate(1)
        g.cut()
        g.paste(0,0,"or")
        r_ne = g.getcells(g.getrect())
        g.select(g.getrect())
        g.rotate(1)
        g.cut()
        g.paste(0,0,"or")
        r_se = g.getcells(g.getrect())
        g.select(g.getrect())
        g.rotate(1)
        g.cut()
        g.paste(0,0,"or")
        r_sw = g.getcells(g.getrect())
elif mode == 'D4':
    r_se = input_pattern
    g.select(initial_box)
    g.flip(1)
    g.select(g.getrect())
    g.cut()
    g.paste(0,0,"or")
    r_ne = g.getcells(g.getrect())
    g.select(g.getrect())
    g.flip(0)
    g.cut()
    g.paste(0,0,"or")
    r_nw = g.getcells(g.getrect())
    g.select(g.getrect())
    g.flip(1)
    g.cut()
    g.paste(0,0,"or")
    r_sw = g.getcells(g.getrect())
else:
    g.exit('Invalid symmetry input.')
g.new("example")
#single_cell = g.parse('o!')
'''Starting and ending bounds'''
if mode == 'C2':
    start_x, end_x, start_y, end_y = -10, 10, -10, 10
elif mode == 'C4':
    start_x, end_x, start_y, end_y = -10, 10, 0, 10
elif mode == 'D4':
    start_x, end_x, start_y, end_y = width+1, width+12, height+1, height+12
elif mode == 'X4':
    start_x, end_x, start_y, end_y = -15, 15, -15, 10
elif mode == 'D8':
    start_x, end_x, start_y, end_y = 0, 15, 0, 15
'''Main loop'''
for x in range(start_x, end_x+1):
    for y in range(start_y, end_y+1):
        for z in range(1 if mode in ('C2','X4') else 8 if mode == 'D8' else 4):
            #if x == 15 and y < 15:
            #    continue
            if mode == 'C4' and not -y-width <= x < y: #C4 has a diagonal bounding box
                continue
            #if x < 0 and y < 0:
            #    continue
            if mode == 'D8' and y > x: #D8 takes only an eighth
                continue
            if mode == 'C4': #rotating
                width, height = height, width
                r_n, r_e, r_s, r_w = r_e, r_s, r_w, r_n
            if mode == 'D8':
                if z % 4 == 0:
                    r_n, r_e, r_s, r_w, r_ne, r_se, r_sw, r_nw = \
                         r_ne, r_se, r_sw, r_nw, r_n, r_e, r_s, r_w
                width, height = height, width
                r_n, r_e, r_s, r_w, r_ne, r_se, r_sw, r_nw = \
                     r_w, r_n, r_e, r_s, r_se, r_sw, r_nw, r_ne
            if mode == 'D4': #flipping
                if z % 2 == 0:
                    r_se, r_ne, r_nw, r_sw = r_ne, r_se, r_sw, r_nw
                else:
                    r_se, r_ne, r_nw, r_sw = r_sw, r_nw, r_ne, r_se
            #if (y,z) == (2,3):
            #    continue
            for spark_type_num in range(4 if spark_mode == 'mwhw' else 1):
                if spark_type_num == 0:
                    spark_type = g.parse('2$b2o$b3o$4o$b3o$b2o!')
                    spark_type2 = g.parse('$b2o$3o$4o$3o$b2o!')
                    spark_type3 = g.parse('3bo$b5o$b5o$2b3o!')
                    spark_type4 = g.parse('3b3o$2b5o$2b5o$4bo!')
                elif spark_type_num == 1:
                    spark_type = g.parse('$b2o$b3o$4o$4o$b3o$b2o!')
                    spark_type2 = g.parse('$b2o$3o$4o$4o$3o$b2o!')
                    spark_type3 = g.parse('3b2o$b6o$b6o$2b4o!')
                    spark_type4 = g.parse('2b4o$b6o$b6o$3b2o!')
                elif spark_type_num == 2:
                    spark_type = g.parse('$2bo$2bo$b3o$2b2o$b3o$2bo$2bo!')
                    spark_type2 = g.parse('bo$bo$3o$2o$3o$bo$bo!')
                    spark_type3 = g.parse('$2bobo$7o$2b3o!')
                    spark_type4 = g.parse('3b3o$b7o$3bobo!')
                else:
                    spark_type = g.parse('2bo$2bo$b3o$2b2o$2b2o$b3o$2bo$2bo!')
                    spark_type2 = g.parse('bo$bo$3o$2o$2o$3o$bo$bo!')
                    spark_type3 = g.parse('$2bo2bo$8o$2b4o!')
                    spark_type4 = g.parse('2b4o$8o$2bo2bo!')
                recent_pops = list(range(100,109)) #9 same population in a row: end
                recent_min_x = list(range(100,108)) #checking for escaping gliders
                current_gen = None
                g.new("example")
                '''Putting patterns in place'''
                if mode == 'C2':
                    g.putcells(r_down, 0, 0)
                    num1 = int(g.getpop())
                    g.putcells(r_up, x, y)
                elif mode == 'C4':
                    g.putcells(r_n, x, y)
                    num1 = int(g.getpop())
                    g.putcells(r_e, y, -x-width+1-a)
                    g.putcells(r_s, -x-width+1-a, -y-height+1-a)
                    g.putcells(r_w, -y-height+1-a, x)
                elif mode == 'D4':
                    g.putcells(r_se, x, y)
                    num1 = int(g.getpop())
                    g.putcells(r_ne, x, 0)
                    g.putcells(r_nw, 0, 0)
                    g.putcells(r_sw, 0, y)
                elif mode == 'X4':
                    '''g.putcells(r_n, x, y)
                    num1 = int(g.getpop())
                    g.putcells(r_w, 0, y-x-width+height)
                    g.putcells(r_e, x+y+width-1, -width+1)
                    g.putcells(r_s, y+height-1, -x-width+1)'''
                    g.putcells(r_n, x, y)
                    num1 = int(g.getpop())
                    g.putcells(r_w, 0, y-x-width+height)
                    g.putcells(r_e, x+y+width, -width)
                    g.putcells(r_s, y+height, -x-width)
                elif mode == 'D8':
                    g.putcells(r_n, x, y)
                    num1 = int(g.getpop())
                    g.putcells(r_ne, -x-width+1-a, y)
                    g.putcells(r_e, y, -x-width+1-a)
                    g.putcells(r_se, y, x)
                    g.putcells(r_s, -x-width+1-a, -y-height+1-a)
                    g.putcells(r_sw, x, -y-height+1-a)
                    g.putcells(r_w, -y-height+1-a, x)
                    g.putcells(r_nw, -y-height+1-a, -x-width+1-a)
                if int(g.getpop()) != copies * num1:
                    continue
                g.run(0)
                #if y == 0 and int(g.getpop()) == 32:
                #    continue
                if g.empty():
                    continue
                g.show(str((x,y)))
                g.update()
                initial_box = g.getrect()
                initial_box[0] -= 1 #must not touch initial pattern
                initial_box[1] -= 1
                initial_box[2] += 2
                initial_box[3] += 2
                hash1 = g.hash(initial_box)
                g.select(initial_box)
                g.flip(0)
                hash2 = g.hash(initial_box)
                g.flip(0)
                g.select(g.getrect())
                g.rotate(1)
                initial_box2 = g.getrect()
                initial_box2[0] -= 1 #must not touch initial pattern
                initial_box2[1] -= 1
                initial_box2[2] += 2
                initial_box2[3] += 2
                hash3 = g.hash(initial_box2)
                g.flip(0)
                hash4 = g.hash(initial_box2)
                g.flip(0)
                g.rotate(0)
                generation_snapshots = [''] * 200 #prevents same sequence from repeating
                test1 = False
                min_x = -100
                for generation in range(150):
                    '''Outer loop'''
                    #g.show('Generation ' + str(generation))
                    if generation == 0:
                        g.run(0)
                        pass
                    else:
                        g.new("example")
                        g.putcells(current_gen)
                    if generation > 0:
                        g.run(1)
                    if g.getcells(g.getrect()) == current_gen:
                        break
                    recent_pops.append(int(g.getpop()))
                    recent_pops.pop(0)
                    if recent_pops[-1] < 4 * copies: #no growth
                        break
                    if recent_pops[-1] > 125 * copies:
                        break
                    if max(recent_pops) == min(recent_pops): #9 generations with same population
                        break
                    #if not g.getcell(8,0) or not g.getcell(0,8): #block broken
                    #break
                    for w in range(1 if mode in ('D4','D8') else 2):
                        if w == 1:
                            g.new("example")
                            g.putcells(current_gen)
                        '''min_x = g.getrect()[0]
                        edge = g.getcells([min_x,-40+y,1,80])[1::2]
                        if not edge:
                            current_gen = g.getcells(g.getrect())[:]
                            continue'''
                        '''temp = g.getcells(g.getrect())
                        g.select([-50,0,100,14])
                        g.clear(0)
                        if g.empty():
                            g.putcells(temp,0,0)
                            current_gen = g.getcells(g.getrect())[:]
                            continue'''
                        prev_min_x = min_x
                        min_x = g.getrect()[0]
                        #if min_x == x or min_x == 0: #used when there's an eater or still life
                        #    current_gen = g.getcells(g.getrect())[:]
                        #    continue
                        edge = g.getcells([min_x,-40+y,1,80])[1::2]
                        if not edge:
                            #g.putcells(temp,0,0)
                            current_gen = g.getcells(g.getrect())[:]
                            continue
                        '''if prev_min_x == min_x: #not a new leading edge
                            #g.putcells(temp,0,0)
                            current_gen = g.getcells(g.getrect())[:]
                            continue'''
                        if w == 1 and max(edge) - len(edge) + 1 == min(edge):
                            #g.putcells(temp,0,0)
                            current_gen = g.getcells(g.getrect())[:]
                            continue
                        while max(edge) - len(edge) + 1 != min(edge):
                            if w == 1:
                                edge.remove(max(edge))
                            else:
                                edge.remove(min(edge))
                        #g.putcells(temp,0,0)
                        current_gen = g.getcells(g.getrect())[:]
                        #g.update()
                        #time.sleep(.5)
                        if w == 0:
                            recent_min_x.append(min_x)
                            recent_min_x.pop(0)
                            '''Checking for gliders'''
                            if g.getcells([min_x+3,min(edge)-8,3,16]): #not by itself
                                recent_min_x[-1] = 123
                            if recent_min_x == [recent_min_x[0]]*4 + [recent_min_x[4]]*4 \
                               and recent_min_x[4] == recent_min_x[0] - 1:
                                for i in range(min_x, min_x+3):
                                    for j in range(min(edge),min(edge)+3):
                                        g.setcell(i,j,0) #delete glider
                                test1 = True
                                current_gen = g.getcells(g.getrect())[:]
                                continue
                            #if not test1:
                            #    continue
                        '''Determine sparks'''
                        if len(edge) == 1:
                            if spark_mode == 'dot':
                                sparks = [(-2,-1),(-1,0),(0,1),(1,2)]
                            elif spark_mode == 'neardot':
                                sparks = [(-1,),(-0,),(1,),(-2,-1),(-1,0),(0,1),(1,2)]
                            elif spark_mode == 'mwhw':
                                sparks = [(-3,),(-2,),(-1,),(0,),(1,),(2,),(3,),(4,)]
                        if len(edge) == 2:
                            if spark_mode == 'dot':
                                sparks = [(-1,),(0,),(2,),(-2,-1),(-1,0),(1,2),(2,3)]
                            elif spark_mode == 'neardot':
                                sparks = [(-1,),(0,),(1,),(2,),(-2,-1),(-1,0),(0,1),(1,2),(2,3)]
                            elif spark_mode == 'mwhw':
                                sparks = [(-3,),(-2,),(-1,),(0,),(1,),(2,),(3,),(4,),(5,)]
                        if len(edge) == 3:
                            if spark_mode == 'dot':
                                sparks = [(-1,),(0,),(1,),(2,),(3,),(-2,-1),(-1,0),(2,3),(3,4)]
                            elif spark_mode == 'neardot':
                                sparks = [(-1,),(0,),(1,),(2,),(3,),(-2,-1),(-1,0),(0,1),(1,2),(2,3),(3,4)]
                            elif spark_mode == 'mwhw':
                                sparks = [(-3,),(-2,),(-1,),(0,),(1,),(2,),(3,),(4,),(5,),(6,)]
                        if len(edge) >= 4:
                            if spark_mode != 'mwhw':
                                sparks = [(-1,),(0,),(1,),(2,),(3,),(4,),(-2,-1),(-1,0),(0,1),(1,2),(2,3),(3,4),(4,5)]
                            else:
                                sparks = [(-3,),(-2,),(-1,),(0,),(1,),(2,),(3,),(4,),(5,),(6,),(7,)]
                        if spark_mode == 'mwhw' and spark_type_num in (0,2): #edge length 3
                            sparks = sparks[:-1]
                        #sparks = [(-20,)]
                        for spark in sparks:
                            '''Add sparks'''
                            g.new("example")
                            g.putcells(current_gen)
                            for spark1 in spark:
                                if mode == 'C2':
                                    if spark_mode == 'mwhw':
                                        g.putcells(spark_type,min_x-5,spark1+min(edge)-4) #-3, -4
                                        g.putcells(spark_type2,-min_x+x+1+width,-spark1-min(edge)+y+height-4)
                                    elif spark_mode == 'dot':
                                        g.setcell(min_x-2,spark1+min(edge),1)
                                        g.setcell(-min_x+x+1+width,-spark1-min(edge)+y-1+height,1)
                                    elif spark_mode == 'neardot':
                                        g.setcell(min_x-1,spark1+min(edge),1)
                                        g.setcell(-min_x+x+width,-spark1-min(edge)+y-1+height,1)
                                elif mode in ('C4','D8'):
                                    if spark_mode == 'mwhw':
                                        g.putcells(spark_type,min_x-5,spark1+min(edge)-4)
                                        g.putcells(spark_type2,-min_x+2-a,-spark1-min(edge)-3-a)
                                        g.putcells(spark_type3,-spark1-min(edge)-3-a,min_x-5)
                                        g.putcells(spark_type4,spark1+min(edge)-4,-min_x+2-a)
                                    elif spark_mode == 'dot':
                                        g.setcell(min_x-2,spark1+min(edge),1)
                                        g.setcell(-min_x+2-a,-spark1-min(edge)-a,1)
                                        g.setcell(-spark1-min(edge)-a,min_x-2,1)
                                        g.setcell(spark1+min(edge),-min_x+2-a,1)
                                    elif spark_mode == 'neardot':
                                        g.setcell(min_x-1,spark1+min(edge),1)
                                        g.setcell(-min_x+1-a,-spark1-min(edge)-a,1)
                                        g.setcell(-spark1-min(edge)-a,min_x-1,1)
                                        g.setcell(spark1+min(edge),-min_x+1-a,1)
                                elif mode == 'D4':
                                    if spark_mode == 'mwhw':
                                        g.putcells(spark_type,min_x-5,spark1+min(edge)-4)
                                        g.putcells(spark_type2,-min_x+x+width+1,-spark1+height+y-min(edge)-4)
                                        g.putcells(spark_type,min_x-5,-spark1+height+y-min(edge)-5+(spark_type_num in (1,3)))
                                        g.putcells(spark_type2,-min_x+x+width+1,spark1+min(edge)-3-(spark_type_num in (1,3)))
                                    elif spark_mode == 'dot':
                                        g.setcell(min_x-2,spark1+min(edge),1)
                                        g.setcell(-min_x+x+width+1,-spark1+height+y-min(edge)-1,1)
                                        g.setcell(min_x-2,-spark1+height+y-min(edge)-1,1)
                                        g.setcell(-min_x+x+width+1,spark1+min(edge),1)
                                    elif spark_mode == 'neardot':
                                        g.setcell(min_x-1,spark1+min(edge),1)
                                        g.setcell(-min_x+x+width,-spark1+height+y-min(edge)-1,1)
                                        g.setcell(min_x-1,-spark1+height+y-min(edge)-1,1)
                                        g.setcell(-min_x+x+width,spark1+min(edge),1)
                                elif mode == 'X4':
                                    center = (x+y+height-1+width, y-x-width+height+1) #actually twice center
                                    offset_x = 2*(min_x-2)-center[0]
                                    offset_y = 2*(spark1+min(edge))-center[1]
                                    if spark_mode == 'mwhw':
                                        g.putcells(spark_type,(center[0]-offset_x)//2-1, (center[1]-offset_y)//2-1)
                                        g.putcells(spark_type2,(center[0]-offset_y)//2-1, (center[1]-offset_x)//2-1)
                                        g.putcells(spark_type3,(center[0]+offset_x)//2, (center[1]+offset_y)//2)
                                        g.putcells(spark_type4,(center[0]+offset_y)//2, (center[1]+offset_x)//2)
                                    elif spark_mode == 'neardot':
                                        g.setcell((center[0]-offset_x)//2, (center[1]-offset_y)//2-2, 1)
                                        g.setcell((center[0]-offset_y)//2-1, (center[1]-offset_x)//2-1, 1)
                                        g.setcell((center[0]+offset_x)//2, (center[1]+offset_y)//2, 1)
                                        g.setcell((center[0]+offset_y)//2+1, (center[1]+offset_x)//2-1, 1)
                                    elif spark_mode == 'dot':
                                        g.setcell((center[0]-offset_x)//2-1, (center[1]-offset_y)//2-2, 1) #-2, -1
                                        g.setcell((center[0]-offset_y)//2-1, (center[1]-offset_x)//2-2, 1) #-1, -2
                                        g.setcell((center[0]+offset_x)//2+1, (center[1]+offset_y)//2, 1) #+1, 0
                                        g.setcell((center[0]+offset_y)//2+1, (center[1]+offset_x)//2, 1) #0, +1
                                if mode == 'D8':
                                    if spark_mode == 'mwhw':
                                        g.putcells(spark_type,min_x-5,-spark1-min(edge)-4-a+(spark_type_num in (1,3)))
                                        g.putcells(spark_type2,-min_x+2-a,spark1+min(edge)-3-(spark_type_num in (1,3)))
                                        g.putcells(spark_type3,spark1+min(edge)-3-(spark_type_num in (1,3)),min_x-5)
                                        g.putcells(spark_type4,-spark1-min(edge)-4-a+(spark_type_num in (1,3)),-min_x+2-a)
                                    elif spark_mode == 'dot':
                                        g.setcell(min_x-2,-spark1-min(edge)-a,1)
                                        g.setcell(-min_x+2-a,spark1+min(edge),1)
                                        g.setcell(spark1+min(edge),min_x-2,1)
                                        g.setcell(-spark1-min(edge)-a,-min_x+2-a,1)
                                    elif spark_mode == 'neardot':
                                        g.setcell(min_x-1,-spark1-min(edge)-a,1)
                                        g.setcell(-min_x+1-a,spark1+min(edge),1)
                                        g.setcell(spark1+min(edge),min_x-1,1)
                                        g.setcell(-spark1-min(edge)-a,-min_x+1-a,1)
                                x1, y1 = min_x-5,spark1+min(edge)
                                current_gen_a = g.getcells(g.getrect())[:]
                            #g.update()
                            #time.sleep(.4)
                            hash_list = []
                            test2a += 1
                            recent_pops1 = list(range(100,139)) #40 generations same population: end
                            for generation1 in range(200):
                                #g.update()
                                '''Inner loop'''
                                g.run(1)
                                if not int(g.getpop()): #g.getrect() crashes if empty
                                    break
                                if 5 <= generation1 <= 8: #prevents repeating evolution
                                    if g.hash(g.getrect()) in generation_snapshots:
                                        generation_snapshots.pop(0)
                                        generation_snapshots.append(g.hash(g.getrect()))
                                        if int(g.getpop()) > 6:
                                            test2 += 1
                                        #g.show(str(test2/test2a))
                                        break
                                    generation_snapshots.pop(0)
                                    generation_snapshots.append(g.hash(g.getrect()))
                                recent_pops1.append(int(g.getpop()))
                                recent_pops1.pop(0)
                                #if recent_pops1[-1] < 4 * copies: #no growth
                                #    break
                                if recent_pops1[-1] > 250 * copies: #too complicated, very unlikely
                                    break
                                if max(recent_pops1) == min(recent_pops1):
                                    break
                                if generation1 % 10 == 0: #checks for same pattern
                                    hash_list.append(g.hash(g.getrect()))
                                    if hash_list[-1] in hash_list[:-1]:
                                        break
                                #if not g.getcell(8,0) or not g.getcell(0,8): #block broken
                                #    break
                                if generation1 > 3 and g.getcell(x1, y1): #hits sparker
                                    break
                                if g.hash(initial_box) in (hash1, hash2) or g.hash(initial_box2) in (hash3, hash4):
                                    g.warn("Partial found")
                                    #if y == 2 and generation+generation1 in (45,91):
                                    #    continue
                                    #if (y, generation, int(g.getpop())) == (1,2,72):
                                    #    continue
                                    g.reset()
                                    g.select(g.getrect())
                                    g.copy()
                                    if generation != 0:
                                        with open("partials.txt", "a") as writefile:
                                                writefile.write(str(generation) + "\n" + str(pyperclip.paste() + "\n"))
                                                writefile.flush()
                                                writefile.close()
                                            #g.warn("Partial found")

Disaster16439
Posts: 191
Joined: June 30th, 2023, 9:17 am
Location: Suffocating(my coordinates are 3,-64,192929929)

Re: Thread for your script-related questions

Post by Disaster16439 » December 18th, 2023, 7:09 pm

Can someone make an INT JLS?
I QUIT CA

Para
Posts: 89
Joined: August 26th, 2023, 10:48 pm
Location: Somewhere

Re: Thread for your script-related questions

Post by Para » December 20th, 2023, 10:27 pm

Disaster16439 wrote:
December 18th, 2023, 7:09 pm
Can someone make an INT JLS?
You can use RLS.
https://alephalpha.github.io/rlifesrc/

Code: Select all

x = 9, y = 19, rule = B3-qy4e5j6i/S2-cn3-k4i
3$3bo$2b3o2$3bo$4b2o4$3bo$2b2o!

Disaster16439
Posts: 191
Joined: June 30th, 2023, 9:17 am
Location: Suffocating(my coordinates are 3,-64,192929929)

Re: Thread for your script-related questions

Post by Disaster16439 » December 20th, 2023, 10:28 pm

Para wrote:
December 20th, 2023, 10:27 pm
Disaster16439 wrote:
December 18th, 2023, 7:09 pm
Can someone make an INT JLS?
You can use RLS.
https://alephalpha.github.io/rlifesrc/
I know, but inputting cells is a real pain.
I QUIT CA

User avatar
Tawal
Posts: 245
Joined: October 8th, 2023, 7:20 am

Re: Thread for your script-related questions

Post by Tawal » January 6th, 2024, 9:09 am

Is there a script to connect two H (or other input/output) ?

For example :
Is there a script which find the circuit to connect this yellow H input to the red H output ?

Code: Select all

x = 48, y = 33, rule = LifeHistory
5$40.E$40.E.E$40.3E$42.E17$6.3D$7.D$5.3D!
Alone we go faster … Together we go further …

Avatar's pattern
Possible uses found by Dave Green
Jormungant's explanation and uses

Currently investigating signal collisions … (stand by)

User avatar
dvgrn
Moderator
Posts: 10693
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: Thread for your script-related questions

Post by dvgrn » January 6th, 2024, 10:34 am

Tawal wrote:
January 6th, 2024, 9:09 am
Is there a script to connect two H (or other input/output) ?

For example :
Is there a script which find the circuit to connect this yellow H input to the red H output ?

Code: Select all

x = 48, y = 33, rule = LifeHistory
5$40.E$40.E.E$40.3E$42.E17$6.3D$7.D$5.3D!
Yes -- for Herschels only. It's Hersrch. It's ancient, and has an ancient walkthrough (three-digit post number!) to explain how to use it. Hersrch's database of conduits is somewhat out of date, so it can easily miss good solutions, especially ones that involve Snarks, Snark64s, syringes, speed tunnels, new G-to-Rs, and so on.

A new database of elementary conduits is in the works -- haven't heard recently from yoleo how progress is coming on that; last mention on Discord was December 23 I think. But building that database is a big and difficult job, and will need tricky search code to find optimal solutions once it's all built. So Hersrch is what we have right at the moment.

User avatar
confocaloid
Posts: 3058
Joined: February 8th, 2022, 3:15 pm

Re: Thread for your script-related questions

Post by confocaloid » January 6th, 2024, 10:41 am

If you're willing to do some manual depth-first exploration, there is a page https://conwaylife.com/w/index.php?oldid=142031 with a table which lists some H-to-H conduits, along with dx/dy/dt information. It is incomplete (it misses some old conduits, and some new conduits were found after the page was last updated). But I did already use that table myself a few times to complete Herschel tracks.
Tawal wrote:
January 6th, 2024, 9:09 am
Is there a script to connect two H (or other input/output) ?

For example :
Is there a script which find the circuit to connect this yellow H input to the red H output ?

Code: Select all

x = 48, y = 33, rule = LifeHistory
5$40.E$40.E.E$40.3E$42.E17$6.3D$7.D$5.3D!
127:1 B3/S234c User:Confocal/R (isotropic CA, incomplete)
Unlikely events happen.
My silence does not imply agreement, nor indifference. If I disagreed with something in the past, then please do not construe my silence as something that could change that.

User avatar
Tawal
Posts: 245
Joined: October 8th, 2023, 7:20 am

Re: Thread for your script-related questions

Post by Tawal » January 6th, 2024, 3:32 pm

dvgrn wrote:
January 6th, 2024, 10:34 am
...
Yes -- for Herschels only. It's Hersrch. It's ancient, and has an ancient walkthrough (three-digit post number!) to explain how to use it. Hersrch's database of conduits is somewhat out of date, so it can easily miss good solutions, especially ones that involve Snarks, Snark64s, syringes, speed tunnels, new G-to-Rs, and so on.
...
Cool but I'm using Linux.
I will try with Wine, perhaps there's a hope.
But first and foremost where is the executable ?



confocaloid wrote:
January 6th, 2024, 10:41 am
If you're willing to do some manual depth-first exploration, there is a page https://conwaylife.com/w/index.php?oldid=142031 with a table which lists some H-to-H conduits, along with dx/dy/dt information. It is incomplete (it misses some old conduits, and some new conduits were found after the page was last updated). But I did already use that table myself a few times to complete Herschel tracks.
...
Yes, that's what I do but it's hard to do it manually especially with a timing restriction.
Thanks a lot for your table ;)
Alone we go faster … Together we go further …

Avatar's pattern
Possible uses found by Dave Green
Jormungant's explanation and uses

Currently investigating signal collisions … (stand by)

User avatar
dvgrn
Moderator
Posts: 10693
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: Thread for your script-related questions

Post by dvgrn » January 6th, 2024, 6:46 pm

Tawal wrote:
January 6th, 2024, 3:32 pm
Cool but I'm using Linux.
I will try with Wine, perhaps there's a hope.
But first and foremost where is the executable ?
I found an executable in the ZIP file that I downloaded, from my old file server (the "4Dec2012" link is the most recent one there). Sokwe's 2022 version of Hersrch also includes a Windows executable.

But Hersrch is just a command-line C++ program. It should be possible to compile it on any OS -- probably starting from Andrew Trevorrow's modified version.

It would be really good to get a new version of the source code united with Sokwe's 2022 Hersrch data files, and get the whole thing tested out and working on Windows, Mac, and Linux.

User avatar
Tawal
Posts: 245
Joined: October 8th, 2023, 7:20 am

Re: Thread for your script-related questions

Post by Tawal » January 7th, 2024, 6:21 am

dvgrn wrote:
January 6th, 2024, 6:46 pm
...
I found an executable in the ZIP file that I downloaded, from my old file server (the "4Dec2012" link is the most recent one there). Sokwe's 2022 version of Hersrch also includes a Windows executable.

But Hersrch is just a command-line C++ program. It should be possible to compile it on any OS -- probably starting from Andrew Trevorrow's modified version.

It would be really good to get a new version of the source code united with Sokwe's 2022 Hersrch data files, and get the whole thing tested out and working on Windows, Mac, and Linux.
Great it works with Andrew Trevorrow's version :)
It compiles with many warnings but it ends well and works.
I was able to connect the two H I gave in example with this result line :

Code: Select all

*** (7500 @ 6580) VFX77 VLX159 VR64E1 VFX153 VLX138 (l=1,p=997,t=391,u=1000)
which gives this pattern :

Code: Select all

x = 133, y = 95, rule = LifeHistory
5$75.A$75.3A$78.A18.2A$77.2A16.A2.A$95.3A$58.A45.2A$58.3A34.3A5.A.A$
61.A33.A2.A4.A6.A$60.2A11.2A11.D10.2A3.2A4.3A$73.2A9.3D20.A$84.D.D20.
2A$84.D4$59.E$59.E.E$59.3E$61.E5$52.2A54.2A$53.A20.2A32.2A$50.3A21.A.
A$50.A25.A$76.2A5$100.D$88.2A10.3D6.2A$88.A.A10.D7.2A$25.3D61.A$26.D$
24.3D4$105.2A$92.2A11.A.A$93.A13.A$90.3A14.2A$90.A$87.2A.A$87.2A.3A
16.C$93.A13.3C$92.A.A11.C$93.A12.2C2$100.3D$24.2A68.2A4.D$15.2A7.2A
10.A57.2A3.3D$16.A17.3A38.A9.A$16.A.A7.D6.A11.A29.3A5.3A$17.2A6.3D5.
2A8.3A17.2A13.A3.A$24.2D2.D13.A20.A13.2A3.2A$42.2A20.A$63.2A$113.2A$
20.2A91.2A$20.2A68.D$90.3D$90.D.D$44.D15.2A30.D15.2A$18.A.2A20.D.D15.
2A46.2A$16.3A.2A20.3D67.2A$15.A13.2A11.D69.2A$15.A.2A.2A8.A$16.A.A.A
6.3A$20.A6.A78.2A$20.2A69.2A13.2A$50.2A19.A6.2A11.A.A$50.A18.3A6.2A
13.A$51.3A14.A24.2A$53.A14.2A!

Many many thanks, it will be very helpful to me 8)


Edit:
Another example of resolution (timing is important, just search on the lowest forwarding of H [have a pre-construction pattern]) :
- in yellow : the global H input
- in red : the H input & output of Hersrch's result + the glider timed with H output.

Code: Select all

x = 240, y = 179, rule = LifeHistory
10$44.2A$45.A$45.A.A$46.2A7$45.2A4.2A$45.2A4.2A4$50.2A$46.2A2.2A$45.A
.A$45.A12.2A$44.2A11.A.A$57.A$56.2A3$39.2A$40.A$39.A$39.2A11.A$37.2A
11.3A3.2A$36.A2.2A8.A5.A.A$37.A.A9.2A4.A$36.2A.A.A4.A7.2A$40.2A3.A.A
6.A$44.A2.A4.A.A$45.2A5.2A2$66.2A$66.2A2$73.A.2A$54.2A17.2A.A$54.2A4$
47.A$46.A.A15.2A$20.A19.2A4.A.A4.2A6.A.A2.A$11.A8.3A17.A2.A3.A3.A2.A
4.3A.A.2A$11.3A9.A17.3A7.3A4.A4.A$14.A7.2A35.3A.A4.2A$13.2A24.7A3.7A
5.2A5.A$39.A6.A.A6.A13.3A$40.A.A.2A3.2A.A.A16.A$41.2A.A5.A.2A$46.A.A$
45.2A.2A2$12.E$12.E.E13.A$12.3E12.A.A$14.E11.A2.A$27.2A16.2A$44.A.A$
24.2A19.A$23.A.A$23.A$22.2A4$47.2A.A$47.A.2A2$40.2A$40.2A16$27.2A$28.
A$28.A.A$29.2A$38.2A121.A$38.2A119.3A$158.A$158.2A$141.2A19.2A$69.A
53.2A17.A19.2A$54.2A13.3A17.2A6.2A.2A22.A17.A.A$54.A17.A16.2A4.A2.A.A
10.A11.A19.2A$23.A31.A15.2A22.2A.A.A10.3A9.2A39.A$23.3A28.2A42.A.2A
12.A48.A.A$26.A68.2A.A2.A2.2A7.2A49.A$25.2A68.2A2.A.A.A.A59.3A$98.2A.
A.2A62.A$80.D18.A.A$78.3D18.A.A24.2A$61.2A15.D.D17.2A.2A23.2A$61.2A
15.D$164.2A$22.2A140.2A$21.A.A$21.A$20.2A$58.2A32.2A$58.A20.2A11.2A
23.2A$27.2A3.2A8.2A15.A20.A36.A$27.2A3.2A9.A14.2A17.3A38.3A$40.3A34.A
42.A59.A$40.A137.3A$177.A22.D.D$152.2A23.2A22.2D$147.2A3.2A47.D$147.
2A3$146.2A$147.A4.2A51.D$144.3A5.2A49.3D$144.A41.2A15.D.D$186.2A15.D$
163.2A49.A$162.A.A48.A.A$162.A50.A.A$161.2A10.2A39.A$174.A$171.3A9.2A
$171.A11.A$184.A$183.2A!
The start pattern :

Code: Select all

x = 253, y = 179, rule = LifeHistory
13$58.2A$59.A$59.A.A$60.2A7$59.2A4.2A$59.2A4.2A4$64.2A41.D$60.2A2.2A
42.2D$59.A.A45.2D$59.A12.2A4.3D$58.2A11.A.A5.D$71.A7.3D$70.2A3$53.2A$
54.A$53.A$53.2A11.A$51.2A11.3A3.2A$50.A2.2A8.A5.A.A$51.A.A9.2A4.A$50.
2A.A.A4.A7.2A$54.2A3.A.A6.A$58.A2.A4.A.A$59.2A5.2A2$80.2A$80.2A2$87.A
.2A$68.2A17.2A.A$68.2A4$61.A$60.A.A15.2A$34.A19.2A4.A.A4.2A6.A.A2.A$
25.A8.3A17.A2.A3.A3.A2.A4.3A.A.2A$25.3A9.A17.3A7.3A4.A4.A$28.A7.2A35.
3A.A4.2A$27.2A24.7A3.7A5.2A5.A$53.A6.A.A6.A13.3A$54.A.A.2A3.2A.A.A16.
A$55.2A.A5.A.2A$60.A.A$59.2A.2A2$26.E$26.E.E13.A$26.3E12.A.A$28.E11.A
2.A$41.2A16.2A$58.A.A$38.2A19.A$37.A.A$37.A119.D.D$36.2A120.2D$158.D
3$61.2A.A$61.A.2A$162.D$54.2A104.3D$54.2A104.D.D$160.D5$138.2D$140.2D
$142.2D$143.D$143.3D$141.2D2.D$139.2D4.D$138.D5.D$136.2D6.D$134.2D8.D
$41.2A90.2D9.D$42.A87.3D10.D$42.A.A83.2D13.D$43.2A82.2D14.D$52.2A60.D
10.2D$52.2A59.D8.3D$113.D6.2D$112.D5.2D$112.D4.D$83.A27.D4.2D$68.2A
13.3A25.D2.2D$68.A17.A24.3D$37.A31.A15.2A$37.3A28.2A42.2D$40.A73.2D$
39.2A75.3D26.6D4.7D4.6D13.D14.D$150.D4.D5.D9.D13.D14.D$94.D55.D4.D5.D
9.D13.D14.D$92.3D55.D4.D5.D9.D13.4D2.D8.D$75.2A15.D.D55.D4.D5.D9.D13.
D14.D2.D$75.2A15.D52.6D4.D5.D4.6D13.D5.D2.4D2.D.D3.4D$145.D9.D5.D4.D
18.D5.D2.D5.2D4.D$36.2A107.D9.D5.D4.D18.D5.D2.D5.D.D3.4D$35.A.A107.D
9.D5.D4.D18.D5.D2.D5.D2.D5.D$35.A109.6D4.7D4.6D14.2D3.D2.4D2.D2.D2.4D
$34.2A$72.2A$72.A$41.2A3.2A8.2A15.A$41.2A3.2A9.A14.2A$54.3A$54.A!
Alone we go faster … Together we go further …

Avatar's pattern
Possible uses found by Dave Green
Jormungant's explanation and uses

Currently investigating signal collisions … (stand by)

User avatar
Tawal
Posts: 245
Joined: October 8th, 2023, 7:20 am

Re: Thread for your script-related questions

Post by Tawal » January 8th, 2024, 6:51 pm

I known double post but it's another subject.

Is it possible to run a bash script in Golly ?
So I can code simple things ...

PS: Bash is not Batch.
Alone we go faster … Together we go further …

Avatar's pattern
Possible uses found by Dave Green
Jormungant's explanation and uses

Currently investigating signal collisions … (stand by)

User avatar
dvgrn
Moderator
Posts: 10693
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: Thread for your script-related questions

Post by dvgrn » January 8th, 2024, 8:35 pm

Tawal wrote:
January 8th, 2024, 6:51 pm
Is it possible to run a bash script in Golly ?
So I can code simple things ...
The two scripting languages that Golly supports are Python and Lua. Neither one is "bash", but both can accomplish the same kinds of tasks as a bash script could. Python is probably slightly easier for most people to pick up if they know another scripting language already -- but Lua comes with Golly and doesn't need a separate install or configuration.

These days you could probably code up what you want to do in the language of your choice, and then just ask ChatGPT for a Golly-compatible Python or Lua version of the code. My last couple of tries at porting code with ChatGPT had just one or two minor easily fixable errors in chunks of code dozens or hundreds of lines long -- definitely an impressive time savings over doing the translation myself.

User avatar
Tawal
Posts: 245
Joined: October 8th, 2023, 7:20 am

Re: Thread for your script-related questions

Post by Tawal » January 9th, 2024, 6:38 pm

dvgrn wrote:
January 8th, 2024, 8:35 pm
...
These days you could probably code up what you want to do in the language of your choice, and then just ask ChatGPT for a Golly-compatible Python or Lua version of the code. My last couple of tries at porting code with ChatGPT had just one or two minor easily fixable errors in chunks of code dozens or hundreds of lines long -- definitely an impressive time savings over doing the translation myself.
I'm not aware with IA but OK. Why not ?

How to interact with Golly with bash (read the pattern, selection ..., set state of cells etc) ?
As I understand when I read python script, it need to import specifics golly's functions.
How to access them with bash ?

Edit:
I have already made some awk's scripts (faster than bash) but they directly touch the rle file.
So I need to reload the file to see the result.
Alone we go faster … Together we go further …

Avatar's pattern
Possible uses found by Dave Green
Jormungant's explanation and uses

Currently investigating signal collisions … (stand by)

User avatar
dvgrn
Moderator
Posts: 10693
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: Thread for your script-related questions

Post by dvgrn » January 9th, 2024, 9:11 pm

Tawal wrote:
January 9th, 2024, 6:38 pm
How to interact with Golly with bash (read the pattern, selection ..., set state of cells etc) ?
As I understand when I read python script, it need to import specifics golly's functions.
How to access them with bash ?
Oh -- if you want to do Golly-specific things, then you're stuck with the scripting languages that Golly supports, I'm afraid -- Python or Lua.

It's just if you wanted to do something else that bash can already do -- file maintenance, concatenation, etc., etc. -- then maybe you could get some porting hints from something like ChatGPT.

User avatar
Tawal
Posts: 245
Joined: October 8th, 2023, 7:20 am

Re: Thread for your script-related questions

Post by Tawal » January 10th, 2024, 5:26 am

Thanks a lot for your answer ;)

So I need to learn Python ... It will be done later.
I still keep my own scripts and run them directly on the rle file.
Alone we go faster … Together we go further …

Avatar's pattern
Possible uses found by Dave Green
Jormungant's explanation and uses

Currently investigating signal collisions … (stand by)

User avatar
Tawal
Posts: 245
Joined: October 8th, 2023, 7:20 am

Re: Thread for your script-related questions

Post by Tawal » January 12th, 2024, 5:19 pm

Me again
What a lout I must be, sorry ...

Is there a script to find predecessors of simple patterns ?
A generation parameter will be great :)

Edit : Be sure I looked before I asked ;)
Last edited by Tawal on January 12th, 2024, 5:26 pm, edited 1 time in total.
Alone we go faster … Together we go further …

Avatar's pattern
Possible uses found by Dave Green
Jormungant's explanation and uses

Currently investigating signal collisions … (stand by)

Post Reply