Golly scripts

For scripts to aid with computation or simulation in cellular automata.
User avatar
rabbit
Posts: 242
Joined: March 4th, 2024, 6:00 am
Location: Stuck inside a magician's hat. it hurts so bad

Re: Golly scripts

Post by rabbit »

hotdogPi wrote: September 3rd, 2026, 3:33 pm Hopefully this won't 403, because for some inexplicable reason, trying to post this unzipped gives me a 403 error on both the forum and the wiki.
The issue appears to be the presence of the string "sleep(#)" within the script's source, where # is replaced with a number like 123 or 0.4. Attempting to post or preview with that in the body causes a 403.
That's the bunny.
Check out my OCA exploration script, crule.lua!
User avatar
NNlk05
Posts: 593
Joined: January 14th, 2026, 8:42 pm
Location: Exploring in the Jungle of the INT Rulespace
Contact:

Re: Golly scripts

Post by NNlk05 »

rabbit wrote: September 3rd, 2026, 3:54 pm The issue appears to be the presence of the string "sleep(#)" within the script's source, where # is replaced with a number like 123 or 0.4. Attempting to post or preview with that in the body causes a 403.
Can comfirm
Feci quod potui, faciant meliora potentes.

Code: Select all

x = 10, y = 3, rule = B34twz/S23
b2o4b2o$obo4bobo$2bo4bo!
[[ AUTOSTART AUTOHIDEGUI TRACK 0 -47/270 ZOOM 4 GPS 45 STEP 3 THEME BOOK ]]
https://nnlk05.github.io

=3
hotdogPi
Moderator
Posts: 2260
Joined: August 12th, 2020, 8:22 pm

Re: Golly scripts

Post by hotdogPi »

There were four instances, but they were all commented out anyway, so here is the code.

Code: Select all

import golly as g
import time

'''Initializing'''
g.select([0,0,1,1])
#g.autoupdate(1)
g.new("example")
sparker = g.parse('''
14b3o$14bobo$6b2o6b3o$5bobo6b3o$2o3bo8b3o$2o3bobo6b3o$6b2o6bobo$14b3o
5$10bo$9bobo$10b2o!
''')
g.putcells(sparker, 0, 0)
sparker_pop = int(g.getpop())
sparker_box = g.getrect()
g.new("example")
type_ = 'r'
if type_ == 'hf':
    target_pattern = g.parse('2b3o$bo3bo$o5bo$o5bo$o5bo$bo3bo$2b3o!')
elif type_ == 'tl':
    target_pattern = g.parse('2bo$bobo$o3bo$bobo$2bo!')
elif type_ == 'pi':
    target_pattern = g.parse('b3o$o3bo$2ob2o!')
elif type_ == 'r':
    target_pattern = g.parse('2bo$2ob2o$o2bo$b2o!')
elif type_ == 'c':
    target_pattern = g.parse('b3o$bobo$o2bo$2o!')
rotation = 2
g.putcells(target_pattern, 0, 0)
for i in range(rotation):
    g.select(g.getrect())
    g.rotate(1)
    if i == 3:
        g.flip(0)
target_pop = int(g.getpop())
target_box = g.getrect()
if type_ == 'pi' and rotation == 0:
    target_box[3] += 1
hash1 = g.hash(target_box)
g.select(target_box)
g.flip(0)
g.flip(1) #180 degree rotation
target_pattern = g.getcells(target_box)
period = 45
g.new("example")
g.putcells(sparker, 0, 0)
minpop = int(g.getpop())
initial_box = g.getrect()
stator_cells = set(zip(g.getcells(g.getrect())[::2],g.getcells(g.getrect())[1::2]))
for i in range(period):
    g.run(1)
    minpop = min(minpop, int(g.getpop()))
    for j in (0,1):
        initial_box[j] = min(initial_box[j],g.getrect()[j])
    for j in (2,3):
        initial_box[j] = max(initial_box[j],g.getrect()[j])
    stator_cells = set.intersection(stator_cells,set(zip(g.getcells(g.getrect())[::2],g.getcells(g.getrect())[1::2])))
    g.show(str(len(stator_cells)))
    #g.update()
    #time.REDACTED(0.1)
width = g.getrect()[2]
height = g.getrect()[3]
#single_cell = g.parse('o!')
start_x, end_x, start_y, end_y = -15, 20, -9, 0
for y in range(start_y, end_y+1):
    for x in range(start_x, end_x+1):
        #if y == -18 and x < 4:
        #    continue
        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'''
        g.putcells(sparker, 0, 0)
        #g.putcells(target_pattern, x, y)
        g.run(0)
        if g.empty():
            continue
        found = []
        for generation in range(period):
            g.new("example")
            g.putcells(sparker, 0, 0)
            g.run(generation)
            sparker_pop = int(g.getpop())
            g.putcells(target_pattern, x, y)
            if int(g.getpop()) != sparker_pop + target_pop:
                continue
            original = g.getcells(g.getrect())
            hash_list = []
            broken = False
            if generation == 0:
                g.show('%s, %s' % (x, y))
                g.update()
            for generation1 in range(200):
                if broken:
                    break
                g.run(1)
                if generation1 % 15 == 0 and not g.getcell(14,0): #temporary
                    break
                if generation1 % 12 == 0 or generation1 % period == 0:  # checks for same pattern
                    hash_list.append(g.hash(g.getrect()))
                    if hash_list[-1] in hash_list[:-1]:
                        break
                max_x = None
                if max_x is None:
                    top_rect = g.getrect()
                else:
                    g.select([-50,-50,50+max_x,100]) # maximum x to check
                    g.shrink()
                    top_rect = g.getselrect()
                g.select(top_rect)
                # g.update()
                # time.REDACTED(.1)
                top_rect[1] = top_rect[1]
                top_rect[3] = target_box[3]
                g.select(top_rect)
                #g.update()
                #time.REDACTED(.1)
                g.shrink()
                top_rect = g.getselrect()
                top_rect[1] = top_rect[1]
                top_rect[2] = target_box[2]
                top_rect[3] = target_box[3]
                #g.update()
                #time.REDACTED(0.2)
                for cell in stator_cells:
                    if not g.getcell(cell[0],cell[1]):
                        broken = True
                        break
                '''if generation1 % period == 1 or g.hash(top_rect) == hash1:
                    temp = g.getcells(g.getrect())
                    g.select(sparker_box)
                    g.clear(1)
                    #g.warn('%s, %s, %s, %s' % (generation, generation1, int(g.getpop()), sparker_pop))
                    #g.update()
                    if generation1 % period == 1 and int(g.getpop()) < sparker_pop:
                        break
                    if int(g.getpop()) < minpop:
                        g.warn('%s, %s' % (int(g.getpop()), minpop))
                    g.new("example")
                    g.putcells(temp, 0, 0)'''
                if g.hash(top_rect) == hash1:
                    total_gens = generation+generation1
                    #if total_gens < 3:
                    #    continue
                    if len(g.getcells(sparker_box))//2 < minpop: #sparker region has missing cells
                        #g.warn(str([len(g.getcells(sparker_box)) // 2, minpop]))
                        continue
                    if int(g.getpop()) < minpop + target_pop: #total has too few cells
                        continue
                    if generation1 in (10,13) and type_ == 'tl': #common 11 and 14 pushes for traffic lights
                        continue
                    if generation1 == 77 and type_ == 'hf':  # common 78 push for honey farms
                            continue
                    if generation1 in (10,61) and type_ == 'lom':  # common 11 and 62 pushes for lumps of muck
                        continue
                    if generation1 == 25 and type_ == 'r' and rotation == 0:  # p52 shuttle (26-tick push)
                        continue
                    if generation1 == 41 and type_ == 'r' and rotation == 1:  # p84 shuttle (42-tick push)
                            continue
                    if generation1 == 122 and type_ == 'c' and rotation == 4:  # p246 shuttle (123-tick push)
                        continue
                    if generation1 == 87 and type_ == 'pi' and rotation == 1:  # p246 shuttle (123-tick push)
                        continue
                    if generation+generation1 in found:
                        continue
                    #if int(g.getpop()) == 178:
                    #    continue
                    #if min(recent_pops1[-min(10,total_gens):]) == max(recent_pops1[-min(10,total_gens):]):
                    #    continue
                    #g.putcells(current_gen_a, 100, 0)
                    #g.new("example")
                    g.putcells(original, -100, 0)
                    #g.getcells(g.getrect())
                    g.update()
                    g.warn('Found: %s, %s, %s' % (y, x, generation1+1))
                    #generation_snapshots = [''] * 200
                    found.append(generation+generation1)
                    break
User:HotdogPi/My discoveries

Periods discovered:

All evens ≤128 except 52,58,78,82,92,94,98,104,118,122

5-15,㉕-㉛,㉟㊺,51,63,65,73,75
1㊳㊵㊹㊼㊽,54,56,72,74,80,90,92
217,240,300,486,576

Guns: 20,21,32,54,55,57,114,117,124,126
SKOPs: 32,74,76,102,196
Post Reply