Here's is a new version of the script.
This time it compacts the holes in the Printer by 308 cells back.
Again all functions are kept.
Code: Select all
# BitMap Printer - p154 Loafer Gun - Mirrored Engine
# User Choices :
# - Scrolling direction.
# - Initialisation (all gliders inner loops and 1rst frame getting out).
# - Eater Wall (or not) placement.
#
# HOW TO :
# Select a 2 states pattern.
# Run the script.
# Enter a configuration string : <scrolling><init><distance>
# scrolling = single letter : 'U', 'D', 'L' or 'R' (Up, Down, Left or Right).
# init = single symbol : '+' or '-' Initialise the Printer or not (+ = initialise).
# distance = positive integer : distance in percentage of BitMap's width to place the Eater Wall (0 = no Eater Wall).
#
# You to have include spaces between frames in your BitMap selection.
# There isn't any gun included for empty lines (scrolling direction).
# So holes can appear in the BitMap Printer.
# The empty lines on each edge (scrolling direction) allow the number of guns on each side to be shifted.
# This means that you can retrieve a one-side Printer at the extreme.
#
# Minimal BitMap Output Width = 7
# Spaces are added (up to a total of 7) on the right for BitMap's Width < 7
#
# HOW IT WORKS :
# Gun array offset -316,25 de-phased 98 ticks from previous gun.
# 4 basic loops to cover all BitMap widths (bits in loop : 7+4n, 8+4n, 9+4n or 10+4n).
# Trombones slides management :
# Get the minimum needed number of trombones slides (back and forth).
# Adjust the maximum of last NE slides to get a better bounding box.
# Add an inserter for each loop.
# Add the external input Gliders streams (with Synchronization).
# Compact if holes appear (308 cells back for each hole).
# If required :
# Run until BitMap Printer is initialized.
# Remove the inserters.
# Add the Eater Wall
#
# From an original idea of Otismo and its beginnings.
#
#
# Authors :
# - Entity Valkyrie 2 : p154 G to Loafer (BitMap Printer Core) : https://conwaylife.com/forums/viewtopic.php?f=2&t=6537&start=25#p187367
# - Otismo : Gun array with offset and phase difference : No link ! It's been removed !
# - dvgrn : Timed Gliders streams constants : https://conwaylife.com/forums/viewtopic.php?f=2&t=6537&start=25#p187375
# - Tawal : Loops, Trombone Slides and program core : https://conwaylife.com/forums/viewtopic.php?f=9&p=188737#p188737
#
# Last version : 2024-11-17
import re
import golly as g
g.setalgo("HashLife")
g.setrule("b3s23")
### Functions ###
## Compute the coordinates for top or bottom component belong rank in the Printer it has to be placed.
# Need height-1 of the object (h_minus).
# 248 is X symmetry axis of top+bottom guns
# 195 is X offset between top and bottom component.
def xy_fit(typ, x, y, step, h_minus):
xx = x + 316 * step
yy = y - 25 * step
if typ == "bottom":
xx = xx + 195
yy = 248*2 - yy - h_minus
return xx, yy
## Ckeck if there's other guns to put on same side
def more_gun(typ, rank):
# typ = string : "top" or "bottom"
# rank = integer : line number of the BitMap
if typ == "top":
fin, step = -1, -1
else:
fin, step = h, 1
for i in range(rank, fin ,step):
if row_sum[i] > 0:
return True
return False
## Return a gun+loop+gliders cells list belong parameters
def put_part(typ, step, line, gun, loop, glid, offset):
# typ = string : top or bottom
# step = integer : gun column in pattern
# line = integer : line number to print
# gun = list : [ pat_gun, h_gun-1]
# loop = list : [ pat_loop, h_loop-1, nb_slide]
# glid = list : [ [4 gliders 133 or not], (x, y), phase]
# offset = integer : X offset to fill the holes between guns
# Return : cells list : gun+loop+stream
h_g_minus, g_adj = 0, 0
sign =1
if typ == "bottom":
sign = -1
h_g_minus = 2
g_adj = 4 # Offset between top and bottom streams to be synchronized together (x77 cells).
# Gun
x, y = xy_fit(typ, 0, 0, step, gun[1])
gunin = g.transform(gun[0], x, y + gun[1], 1, 0, 0, sign)
comp = g.transform(gunin, -offset, 0)
# Loop
x, y = xy_fit(typ, 0, 0, step, loop[1])
loopin = g.transform(loop[0], x, y+ loop[1], 1, 0, 0, sign)
comp = g.join(comp, g.transform(loopin, -offset, 0))
# Input Glider Stream
dx = glid[1][0] - ((33*loop[2])//77 + 2 + g_adj)*77 - offset # Stream need to be shifted by 'nb_slides x slide_width' + offset to fit period 154.
dy = glid[1][1] - ((33*loop[2])//77 + 2 + g_adj)*77
dx, dy = xy_fit(typ, dx, dy, step, h_g_minus)
for j in range(w):
if row[line][w-j-1] == 1:
if glid[2] == 0:
glidin = g.transform(glid[0][(j+1)%2], dx, dy+h_g_minus, 1, 0, 0, sign)
comp = g.join(comp, g.transform(glidin, offset//4*7, sign*(offset//4)*7))
else:
glidin= g.transform(glid[0][j%2+2], dx, dy+h_g_minus, 1, 0, 0, sign)
comp = g.join(comp, g.transform(glidin, offset//4*7, sign*(offset//4)*7))
dx -= 38+(j+1+glid[2])%2
dy -= sign * (38+(j+glid[2])%2)
return comp
### Is script valid to run ###
srect = g.getselrect()
if srect == []:
g.select(g.getrect())
srect = g.getselrect()
if srect == [] or len(srect) % 2 > 0:
g.exit("Please select a bitmap area in any two-state rule, to produce a p154 bitmap loafer printer for it.")
ix, iy, iw, ih = srect
if iw + ih > 99999:
g.exit("That's an awfully big bitmap to gunnify. Change the script if you want to try it.")
## User Choice
valid = None
regex = re.compile(r"^(?P<orient>(U|D|L|R))"
r"(?P<init>(\+|-))"
r"(?P<dist>([0-9]+))$")
prompt = """Enter a printer configuration string:
<scrolling direction><init><distance>
<scrolling direction> must be a single letter: U (up), D (down), L (left), R (right).
<init> must be a single symbol: + (initialise), - (do not initialise).
<distance> percentage of BitMap's width to place the Eater Wall (0 = no Eater wall).
Example : 200 = 2 complete frames.
/!\ BitMap Printer's initialisation can take a long time. /!\
Examples:
L+100 scrolling to the left, initialise, Eater Wall at 1 frame out.
R-0 as default, scrolling to the right, do not initialise, no Eater wall.
"""
initial = "R-0"
title = "BitMap Printer Creator"
while not valid:
s = g.getstring(prompt, initial, title)
s = s.upper()
valid = regex.match(s)
orient = valid.group("orient")
init = valid.group("init")
dist = int(valid.group("dist"))
msg1 = "Please wait : "
msg2 = "Computing your BitMap Printer … "
g.show(str(msg1) + str(msg2))
### Input bitmap ### transformed to match user's choice
up = (0, 1, -1, 0)
down = (0, -1, 1, 0)
left = (-1, 0, 0, -1)
right = (1, 0, 0, 1)
if orient == "U":
t = up
tb = down
elif orient == "D":
t = down
tb = up
elif orient == "L":
t = left
tb = left
else: # Default
t = right
tb = right
bitmap = g.getcells(srect)
g.addlayer()
g.putcells(bitmap, 0, 0, tb[0], tb[1], tb[2], tb[3])
# to keep the blanks in selection
x = ix * tb[0] + iy * tb[1]
y = ix * tb[2] + iy * tb[3]
if orient == "U" or orient == "D":
w, h = ih, iw
x = x - ih +1
if orient == "D":
x = x + ih - 1
y = y - iw +1
elif orient == "L" or orient == "R":
w, h = iw, ih
if orient == "L":
x = x - iw + 1
y = y - ih + 1
if w < 7: w = 7 # Minimal width is 7 pixels
# BitMap matrice (right order for Gliders streams)
row = dict()
row_sum = dict()
for j in range(h):
row[j] = []
for i in range(w):
row[j].append(1 if g.getcell(i + x, j + y) > 0 else 0)
row_sum[j] = sum(row[j])
g.dellayer()
### Hard Datas : p154G-Loafer, Reflectors, Inserter, Gliders ###
# p154 G to Loafer
p154G_Loafer = g.parse("2$248bo$166b2o78b3o$159b2o6b3o75bo$159bo5bo4bo7b2o65b2o$160b3obob4o7bobo$162bobo4bo8bo43bo42bo$163bobobo54b3o38b3o$165b2o2b2o54bo20b2o14bo$161bo3b2o2b3o52b2o19bobo14b2o14b2o$160bobob3o2b3o73bo32b2o$160bobob3o2b3o73b3o$161bo3b2o2b3o$165b2o2b2o17b2o60bobo31b2o$163bobobo19bobo60bobo31b2o$162bobo4bo17bo7b2o2bo52bo27b2o$160b3obob4o17b2obo4b2o2b2o79b2o$159bo5bo4bo19b2o8b2o13b2o35bo$159b2o6b3o19b2o24b2o39bo$166b2o28bo41b2o11bo4bo$238bobo10bo33b2o$240bo10bo33b2o$228b2o10b2o$228bo23b2o7b2o3bo$218b2o9b3o20b2o7bo3bobo$219bo11bo16b2o12bo3b2o$218bo28bobo13bo$218b2o27bo13bob5o$246b2o12bobo4bo$260bobo2bo$261bo3b2o2$283b2o$282bobo$280b3o2b2o$279bo3bobo2bo$265b2o12bobobo3b2o$264bobo16bo$264bo15b2o3bo$141b3o83b2o34b2o18b2obo$140b4o83bo56bobo2bo$133b2o4b2o3b4o77bobo4b2o51b2obobo$133b2o3b2o2b2ob3o77b2o4bobo38bo13bo2bo33b2o$140b4o85b3o2b2obo33b3o10bobo36bo$228bo3bobob2o32b2o2bo9b2o9b2ob2o4b2o15bobo4b2o$228bobobo10b2o25bo23bob2obo4bo16b2o4bobo$229b2obo10b2o25b3o21bo4bob2obo20b3o2b2o$140b4o86b3obo3bo14bo3b2o11b2ob2o17b2ob4obobo2b2o17bo3bobo2bo$133b2o3b2o2b2ob3o84b2obobobob6o5b4o3bo13bob2o14bobo4bobo2bobo19bob2o3b2o$133b2o4b2o3b4o77bo9bobobobo5bo3bo5bobo12b2o2bo14bob2o2b2obob2o2bo19bo2bo$140b4o79b3o8b2obobo2bo2bobo2bo2bo5b2o13b2o14b2obobob2obo3b2o21bo2bo$141b3o91bobob4obobo8bob2o3bo25bo4b2o2b3o2b2o27bo$228bo4bobobo4bobo8b2o3b2o28bob3o4bo5bo12b2o10b2obo2bo$223bo5bo3b2o2bob2o3b2o4bo3b2obo30bo4b4o4bo14b2o13bobobo$224bo4bo7b2obob2o2bo5b2o5bo2bo27b2obo7b2o28bo2bo$224bo2b2o12bobobo2bo4bobo5bo29bobob2o32bobo$206b2o15b2o3bo8b3obo3bob2o4bo3b4o30bobob2o32b2o9b2ob2o4b2o$201b3o2bobo14bo13bo2bob2obo5b2ob2o3bo24bo3b2ob2o46bob2obo4bo$201bo2b3obo14b2o15bo3b2ob2o3bo30b4o3bo48bo4bob2obo$200bob3obob2o13b2o3bo4bo5b2obo3bo2bo2bo29bo5bobo6bobo2b2o33b2ob4obobo2b2o$199b3o2b4o2bo13bo7bobo3bo2b5o2bobob2o27bo2bo5b2o4bo2bo2bobo11bo3bo15bobobo4bo2bobo$199b3o7b3o12bo3b2o3bo3b3obo7b2o4bo30bob2o3bo3b2obo3bo9b2o5b2o13bo2b3o2b2ob2o2bo$200bo2b4o2b3o16b2o8bo3b2o7b3obo28b2o3b2o10b2ob2o10bo3bo14b2obobo3b2o3b2o$201b2obob3obo14b3o11b2obobo2b3o5bo25bo3b2obo12b2o2bo29bo2b2o7b2o$202bob3o2bo30bo2bo2bo3bob2o14b2o13b2o5bo2bo3b3o3b3o31bo3bo6bo$181bobo18bobo2b3o30bo3b2ob2obobo14bo2b2o12bobo5bo4bo2b2o17b3o13bo2b4o4bo$122b3o55bo19b2ob2o32b2ob2o5bob2obo2bo11b2obo13bo3b4o5b2ob2o16bo2bo13b2obo7b2o$124bo55bo3bo11b2obobo30b3o2bobo4b2obobobob3o13b2ob2o11b2o3bo7bo3bob2o11bo3b2o13bobob2o$123bo56bo15b2obobo30bo2b3obo4bo2bobobo19b3o24bobo2bo2bo5b2o6bo2bo12bobob2o$180bo2bo6b2o7bob2o11b3o14bob3obob2o5bo2b2obob2o17bo22b2ob2o2bobo4bob4o2b4obo4bobo2b2ob2o$180b3o3b2obobo4b4o3bo8b2o16b3o2b4o2bo5b2obob2obo2b2o9bo2b2o18b2obobo12bo2bo6b2o5bo2bo2bobo$187bobo5bo4bob3o3bo3b2o3bo12b3o7b3o5bobo4bobobo10b3o19b2obobo13b2o3bo11b2obo3bo$187bob2o3bo2bob2o2bo3bobo7bo13bo2b4o2b3o3bobobob2obobo13bo14b2o7bob2o13bo2bo16b2ob2o$186b2obo2bobo4bob2o5bo4bo3b2o13b2obob3obo3bobob2o2bobob2o28bo4b4o2bo13b3o17b2o2bo$165b2o20bo2b3obo2b2o2bo15b2o14bob3o2bo4bo5bobobobobo25bo6bo3bo31b3o3b3o11b2o$165bobo19bobo2bobo4bobo16bo14bobo2b3o5b6obobobob2o24b2o7b2o2bo29bo2b2o16bo$166bo19b2o2bobob4ob2o12bo3b2o15b2o18bo3bo3b2o19b2o3b2o3bobob2o14bo3bo10b2ob2o10b2o4bobo$162bo25bob2obo4bo14b2o2bo30b2o10bo21bo2b2ob2o2b3o2bo13b2o5b2o9bo3bob2o6bobo4b2o$163bo24bo4bob2obo13bo4bo30b2o10bobobo18bobo2bo4bobobo15bo3bo11bobo2bo2bo3b2o2b3o$161b3o23b2o4b2ob2o9b2o3bo5bo36b2obobo3bo17b2o2bobob4ob2o33b2o2bobo3bobobo3bo$206bobo4bo41bob2o2b3o20bob2obo4bo44bo4b2obo$115b2o86bo2bo52bobo4b2o16bo4bob2obo43bo4bo2bo$115b2o85bobob2o8b3o40b2o4bobo15b2o4b2ob2o9b2o32bo4bo2bo3bo$203bo2bo9bo48bo36bobo31bo4bo6bobo$206bob2o18b2o34b2o33bo2bo33bobo2bob2o$149b2o56bob3o16bo69bobobo13b2o19bobobo9b3o$149b2o58bob2o13bobo70bo2bob2o10b2o20bo2bo5bo2b3obo$128b2o74b2o3bobobo12b2o74bo38bobo6bobobo$107b3o18b2o74bo2bobo3bo89bo2bo15b2o4b2ob2o9b2o3bobo$108b3o95b2o2b3o91bo2bo15bo4bob2obo14bo$208bobo89b2o3b2obo14bob2obo4bo$208b2o50b2o38bo2bobo3bo11b2o2bobob4ob2o33b2o2bobo$258b3o6b2o33b2o2b3o13bobo2bo4bobobo12bo2b3o13bobo2bo2bo$108b3o137b2o7bo4bo5bo35bobo15bob2ob2o2b3o2bo10b2o2b3obo12bo3bob2o$107b3o14b2obo120bobo7b4obob3o36b2o15b2o4b2o3bobob2o6b4o3bobobo11b2ob2o$71b2o52bob3o119bo9bo3bobo56bob2o7b2o2bo5b4ob3o16bo2b2o$71b2o4b3o45bo4bo128bo3b2o57bobo6bo3bo7bo23b3o3b3o$76bo6bo40b2o3b2o128bo61b2obobo4b4o2bo6bo26b2o2bo$75b2obobo2bo175bo3bo2bo39bob2o15b2o7bob2o9bobo21b2ob2o$71b3o6b3o176bo3bobobo38b2obo21b2obobo11bo18b2obo3bo$70bo2bobob2o180bo3bobobo63b2obobo29bo2bo2bobo$70bo6bo160b2o19bo3bo2bo68b2ob2o2bobo22bobo2b2ob2o$74b3o4b2o123b2o29bo2b2o17bo47b2o5bo22bobo2bo2bo29bo$81b2o5bobo115b2o23bo4bo5bo16bo3b2o35b3o4b2o6bo21bo3bob2o18bo11bo2bo$87bo4bo134b2o3bo4b3o2bo16bo3bobo30bo6bo9b3o20b2ob2o21bobo9b2obobo$87bo4bo133bo5bo7b3o15b4obob3o28bo2bobob2o31bo2b2o26bo6bo2b2o$80b2obo3b2o28b2o107bob4o4b2o19bo4bo5bo28b3o6b3o27b3o3b3o23bo7bo$80bob2o33b2o7b2o83b2o14bo7bo2bo19b3o6b2o32b2obobo2bo30b2o2bo16b3ob4o5bo2b4o3b2o$87b2o2b2o33bo84b2o23bobo21b2o40bo6bo30b2ob2o11bobobo3b4o6b2obo3bobobo$87b2o2b2o31bobo80b2o28bo59b2o4b3o30b2obo3bo12bob3o2b2o10bo2b3o3bo$87b3obo32b2o16b2o63b2o88b2o36bo2bo2bobo13b3o2bo9bo2bob2obob2o$78b2o8bo47b2o4b2o192bobo2b2o29b3obo3bobo$78bobo8bo42b2ob2obo237bo3bobo$74bob2o2b3o48b4obob3o72b2o148bo8b2obob2o2bo$74b2obobo3bo129b2o147bobo3b2o2bob2o3b2o$67b2o10b2obo52b3obob4o212bobobo6bobobo4bobo$67b2o9bo2bo28b2o25bob2ob2o144bo68bob3o2bo5bobob2obo3bo$73bo3bo2bo28bobo20b2o4b2o66b2o80bobo4b2o61b3o9bobobo2bob2obo$65b6obobobo32bo22b2o73bo78bo4bo2bo2bo69b2obobobobo5bo$64bo5bobobobob2o10b2o16b2o91b2o4bobo75bob4obo2bobo63bobo6bobobob6o$64bob2obo2bobobo13b2o33b2o74bobo4b2o72bo2bobo4b3o2bob2o61bo3bo2bo3bo$65bo3bob2obobo48b2o70bob2o2b3o75bobobo2bob2o5bob2o64bo2bo9b2o$67bobo4bobobo118b2obobo3bo66b2o7b2ob2obo2bob3obo66bob2o10b2o$66b2o3b2obo2b2o8b3o25b2o73b2o10bo2bo66b4o3bo4b2o3b2o3bob2o65bo3bobob2o$65bo2b2obob2o39bobo12b2o59b2o9bo2bo65b2ob2obo2b4o3b3o2b2obo69b3o2b2obo$64bobo3bo14bo28bo13bo2bo64bo3bob2o66bobo3b3o3bobobo2bo2bob4o68bobo$64bobo3bob3o10bo9bo8b2o2bobo2b2o14b2o57b6obobobob2o67bobo2bo3bo3b3o3bobo6bo68b2o$63b2obob2obo2bo10bobobob2o2bo7bobo2bo2bo75bo5bobobobob2o68b3ob5o4bo3b2ob7o3b2o$62bo3b3o2bo15b2o3bobo8bo3bob2o76bob4o2bobobo71bobobobo23bo$61bobobo3bob2o14bobo2b2o8b2ob2o81bobobob2obobo69b5ob3o15b5o4bo12b2o$61b2o3b4o2bo15b3o2b2o7bo2b2o19b2o62bobo4bobobo67bo3bo2bobo13bo2bo2bo2b2o12b2o5b2o39b2obo$70bo17b3o2b2o7b3o3b3o16bo3b2o2b2o52b2obob2obo2b2o68b3o3bobo13b2o3bo5b2o17b2o39bob2o$68b2o2bo21b2o10b2o2bo13b3o4bobo2bo51bo5bob2o15bo58bob2ob2o18b5o2bo$67bobob2o23bo9b2ob2o13bo4bobob2o52bobobobo18b3o58b4o21bo3b2o$68bo2bo23bobo4b2obo3bo19b2o58bobobob3o13b2obo12bo4b2o40b2o22b3obo17b2o42b2o$71bo15bo6bo2bo3bo2bo2bobo76b2obo4bo2bo13bo14bob2ob3o65bo2bo17b2o42b2o4b3o$70b2ob2o2bobo5b3o6b3o5bobo2b2ob2o77b2obobo14b3o14bo7bo65b2o24b2o41bo6bo$72bobo2bo2bo3bo2bo6bo15bobob2o72bo3bob2o29b2ob2o45bobo11bo36b2o40b2obobo2bo$72bo3bob2o4bobo23bobob2o73b4o13bo18bo2bo3bo42b4o10bo74b3o6b3o$71b2ob2o9bo23b2obo7b2o71b2o2b2o6bo20bo5bo36b2obob2o2bo10bo73bo2bobob2o$71bo2b2o10b2o21bo2b4o4bo70b2o12bobo18bo3bo2bo35bo5bo2b2o28b2o53bo6bo$71b3o3b3o7b2o2b3o17bo3bo6bo67bobob2o10bo22b2ob2o42bo2bo5b3o3b3o11bob4o42bo13b3o4b2o$75b2o2bo7b2o2b3o15bo2b2o7b2o56bobo9bo2bo29bo7bo38bo3bo9bobo16b2obo3b2o38bobo20b2o$75b2ob2o8b2o2bobo14b2obobo3b2o3b2o5b2o50bo11bo30b3ob2obo29b2o7b4o12bo7b2o8bo2b2ob2o39b2o$71b2obo3bo8bobo3b2o15bo2b3o2b2ob2o2bo4b2o46bo3bo10b2obo4b2o22b2o4bob2o27b2o7bo12b4o7b2o9b6o$70bo2bo2bobo7bo2b2obobobo13bobobo4bo2bobo57bo12bob2ob3o30bo37bobo9bo3bo19bo55b2o5b2o$71bobo2b2o8bo9bo14b2ob4obobo2b2o53bo2bo12bo7bo29bo2bo28b3o3b3o5bo2bo42b2o36b2o5b2o$96bo16bo4bob2obo56b3o11b2ob2o22bo10b2obobo41b2o2bo5bo35bobob2o14bobo$113bob2obo4bo48bo21bo2bo3bo18bobo12b2o17b2o13bo10bo2b2obob2o18b2ob2o14bobo15b2o$92b3o8b2o9b2ob2o4b2o47b3o20bo5bo20bo6b2o2b2o20bo13bo10b4o15b2o5bo2bobobo12b2obo16bo$103bobo69bo19bo3bo2bo18bo13b4o13b3o14bo11bobo16bo5b2obo2bo16bob2o31bo5bo$105bo2bo65b2o22b2ob2o29b2obo3bo12bo4b2o38b3o9bo16b4o2bo30b2o5b2o$90b2o13bobobo8b2o67b3o3bo7bo14b3o14bobob2o17bo2bo37bo11b2o15bo3b2o30b2obo3bob2o$90b2o10b2obo2bo9bobo65b3o5b3ob2obo14bo13bo2bo4bob2o14bob3o22b2o22b2o2bobo13b3o31b2o2bo3bo2b2o$105bo10b2o2b3o71b2o4bo12bob2o13b3obobobo16b2o3bo21b4o20bo2bo2b2o15bo31b2ob2o3b2ob2o$101bo2bo9bo2bobo3bo89b3o18bobobobo13bo2b5o18b2ob2obo20b2o20bobo29b2ob2o3b2ob2o$100bo2bo10b2o3bo2bo91bo15b2obo5bo4bobo7b2o5bo3b2o13bobo3b3o41b2o31bo7bo$99bob2o3b2o10bo2bo55bo8b3o37b2o2bob2obob2o8bo8b2o2bo2bo2bo13bobo2bo3bo73b2o5b2o$98bo3bobo2bo9bob2o55bobo8b3o36bobobo4bobo5bo3bo8bo4b5o15b3ob5o73b2o5b2o$99b3o2b2o10bob2o56bobo20bo6bo21bobob2obobobo7bo10bo22bobobobo75b2o5b2o$92bo8bobo9bo2bob2o57bo15b2o3b2o7bo20bobobo2b4obo3bo2bo9b2o4bo10bo4b5ob3o$91b3o8b2o8bobobo53b2o11b2o8b2o3bobo5b2o17b2obobobobo5bo4b3o14bobo8b3o3bo3bo2bobo25b2o$90b5o18bo2bo52bobo11bobo13b3obo21b2obobobob6o23bo8bobobo3b3o3bobo25bo$116bobo50bo15bo15b3o20b2obo3bo38b3o3b4o2bob2ob2o26b3o47bo$97b2o4b2ob2o9b2o49b2o15b2o36bo2bo9b2o31bo3b2o4bo3b4o24bo5bo47bobo4b2o$98bo4bob2obo92b3o18bo2bo10b2o31b2ob2ob4o5b2o24bobo2b2o46bo4bo2bo2bo$98bob2obo4bo90b3obo17bo3bobob2o36b2o2bo3bo32b3obo2bo46bob4obo2bobo$96b2o2bobob4ob2o18bo14bo4b2o42b2o3bobo5b2o14b3o2b2obo35bo2bobobobob2o9b2o17bo4b2obo43bo2bobo4b3o2bob2o$97bobo2bo4bo3bo16bob2o11bob2ob3o42b2o3b2o7bo16bobo39b2obo5bob2o9b2o4b2o12b3o4bob2o39bobobo2b4o3bobob2o$90b2o4bo2b2obo3bo2bobo16bob2o11bo7bo47bo6bo18b2o40bobo4bo18bob2ob2o11b4obobo30bo2bo6b2o2b3o2b5obo$90b2o5b2o3bo4bo3b2o9bobo4b2o11b2ob2o119bo2b5o17b3obob4o9bo3bobo31bo7bo4bo4b2o5b2o$99b2o2bo4b2o32bo2bo3bo116b3o7b2o32b2o3b2o30bo5bo2b4obob3o2b2obo$99bo5bo4b2o2b2o5bo21bo5bo119b4o4bo9b4obob3o49b2obobob3o3bobobo2bo2bob4o$86b2o13bo4b4o12b2o19bo3bo2bo70b2obo43bo2bo4bo11b2ob2obo12b2o38bo3b2o3bo9bobo6bo$87bo12b2o7bob2o9bo23b2ob2o70bob2o43b2obobobo9bo6b2o4b2o6bob2o37bo2bobobobo3b3o2b2ob7o3b2o$81b2o4bobo16b2obobo11bo17bo7bo120b2ob2o8bo2bo11b2o6bo2bo68bo$81bobo4b2o16b2obobo11bo18b3ob2obo116b3o3bo9bo5b2o17b3o36bobobobo2bo14b5o4bo$77bob2o2b3o24b2obo4b2o22b2o4bob2o70b2o42bo2b2obo3b2o3bo8bo16b2o37bo3b2o3bo5bo7bo2bo2bo2b2o$77b2obobo3bo25bob2ob3o18bo11bo71b2o4b2o39bobo4b2o3bo8bo56b3obobob2o4bo7b2o2b2o5b2o$70b2o10b4o26bo7bo17bo11bo2bo73bob2ob2o28bo19b3ob2obo14bo44bo5bo18bob3o2bo$70b2o9bo2bo26b2ob2o23bo9b2obobo70b3obob4o26bobo20b2o16b2o8bo13bo27bo24b2o$76bo3bo30bo2bo3bo19b2o12b2o108bo40b2o5b2o14bobo21bo2bo21bobobo$68b6obobobob2o29bo5bo21bo5b2o2b2o69b4obob3o53b2o25b2o13b2o29b2ob3o12bo3bo$67bo5bobobobo32bo3bo2bo32b4o66b2ob2obo31b5o17b3ob2obo70b4o13b2o4bo$67bobob2o2bobobo35b2ob2o11b2o4bobo9b2obo3bo69b2o4b2o26bo3bo11b2o3bo8bo67bo3b2o17b3o$68bobobob2obobo30bo7bo11b2obo16bobob2obo74b2o28bo13b2o3bo8bo17bo71bo$70bo6bobobo29b3ob2obo11b2obo13bo2bo4bo105b3o2b2o4bo9bo5b2o16b2o72b2o$69b2obob2obo2b2o29b2o4bo14bo14b3obobobob2o101bo5b3ob2obo9bo2bo20b2o$68bo2b2obob2o73bobobo104b2o3bo7bo11bo78b2o$69b2o2bo73b2obo5bo113b2ob2o12b2o74bo2bo$66b2obo3bob3o14b2o13b2o3bo30b2o2bob2obob2o111bo3bo2bo12bobo58bo15b2o$69bob2obo2bo13bobo12bob4o2bo28bobobo4bobo51bo60bo5bo13bo59b2o15bo$67bobo4bo16bo2bo11bobob4o31bobob2obobobo50bo50bo7bo2bo3bo72bo2bo$68bo3bob2o16b2o11b2obobo34bobobo2b4obo28b2o5b2o10b3o48b2ob2o5b2ob2o76b2o$69b4o2bo17bo10bo4b2obo29b2obobobobo5bo28b2o5b2o61b2ob2o6bo7bo$73b2o9b3o18b3o3b3o28b2obobobob6o99b2o2bo6bob2ob3o$71b2o2bo8bobo19bob2o4bo26b2obo3bo109b2o8bo4b2o$70bobob2o32bobob2o26bo2bo9b2o164bo2bo26b2o3bo$71bo2bo10b2o18b4obobo26bo2bo10b2o31b2o5b2o123bo7b2o6b2o13b4o$74bo29bo2b4obo25bo3bobob2o37b2obo3bob2o121bo5bo3bo5bo3bo12b3ob2o$73b2ob2o3bo24bo3b2ob2o24b3o2b2obo39b2o3b2o9bo113bo4b2o2bo6bobobo21bo2bo$75bob4o2bo29bo27bobo44b2ob2o11bo113bo7b2o4b2o24bo$75bobob4o18b2o10bo2bo25b2o45bobo10b3o55bo58bo11bo2b3obo18bo5bo$74b2obobo32b2obobo70b2ob2o66bobo53bob4o10b2o5b2o2b2o7bo4b2obobob3o$73bo4b2obo19bobo8bo2b2o39b2o101bobo54bo3bo12b2o2bo2bo2bo7bo5bo3b2o3bo$74b3o3b3o18b3o9b2o41bo82b2o19bo57bo3bo10bo4b5o14bo2bobobobo$75bob2o4bo10bo17bo2b4o19b2obo15b3o25bobo5bobo43bo15b2o61b4obo11bo$77bobob2o11b2o16b2obo3bo18bob2o17bo26b2o5b2o45b3o11bobo39b3o20bo14b2o4bo9b3o3bobobobo2bo$74b4obobo11bo2bo16bo4bobo36b2o83bo11bo41b4o20bo18bobo14bo3b2o3bo$73bo2b4obo12bobo13bo2bob2obo38bo4b2o76b2o11b2o37b4o3b2o4b2o8b2o4bo18bo8bobobo3b3obobob2o$75bo3b2o13b2o14b3obo3bob2o17b2o17bo3b2o76bo4b2o45b3ob2o2b2o3b2o8bo5bo25b3obob4o2bo5bo$114bo2b2o20b2o4b2o10b2o82bo3b2o49b4o20bo25bo4bo4bo7bo$110b2obob2o2bo24bob2ob2o91bo73bo2bo26b5ob4o4bo2bo$106b2o2bob2obob2o23b3obob4o91bo100b2o2bobobo$106bobobo6bo126bobo96bo2bo2bo2bob2o$108bobob2obobobo18b4obob3o97b2o49b4o43b2obo5bob2o$108bobobo2b2obobo18b2ob2obo146b3ob2o2b2o3b2o37bobob4o$108bobobobo5bo22b2o4b2o141b4o3b2o4b2o36bo2b5o$105b2obobobob6o29b2o113bobo29b4o43b3o4bo$107bo3bo152b2o6bobo21b3o47b4o$103bo2bo9b2o147bo6b2o71bo6b2o$102b4o10b2o155bo71b2obobo2bo$101bo3bobob2o236b2ob2o$102b3o2b2obo232b3o3bo$104bobo161bobo72bo2b2obo$105b2o161b2o76bobo$248bo20bo$248bobo$248b2o2$245bo$93b2o18bo129bobo$93b2o16b2o131b2o$112b2o$240bo$240b2o$239bobo4$241b2o3$114b3o151bo$113b5o75b2o72bobo$113b3ob2o71b3ob2o70bo5b2o$116b2o72b5o73b2o2b2o$82b2o107b3o$82bobo$83bo9b2o174b2o$92bo2bo173bobob2o$93b2o172bobob2obo$267b2o!")
# Inserter
ins = g.parse("14bo$14b3o$17bo$16bobo$16bobo$17bo5$32b2o$32b2o4$12b2o$11bobo$11bo$10b2o7b2o$19b2o2$27b2obo$27b2ob3o$33bo$27b2ob3o$26bo2b2o$25bobo$24bobob2obo$7b2o16bo2bob2o$8bo19bo$8bobo16b2o$9b2o13bobo2b2o$24b2o2bo2bo$29b2o$6bo$5bobo$5bobo$3b3ob2o$2bo$3b3ob2o$5bob2o2$2o$bo18b2o$bobo16bobo$2b2o18bo$22b2o8$12bo$11bobo$11bobo$12bo$7b2o17b2o$6bobo17bobo$6bo21bo$5b2o21b2o!")
h_ins_minus = 62
# Reflectors and Slides
snark_NWNE = g.parse("5b2o$5b2o$2bo$2b5o14b2o$7bo13bo$4b3o12bobo$3bo15b2o$3b4o$b2o3bo3b2o$o2b3o4b2o$2obo$3bo$3b2o3$11b2o$12bo$9b3o$9bo!")
snark64_NWNE = g.parse("5bo$5b3o$8bo$7b2o15b2o$23bobo$3b2o14b2o2bo$2bo2bo13bobob2o$2bob2o14b2obo2bo$b2o22b2o$o3b2o$b3o2bo$4b2obo15b2o$3bo2bo5bo10b2o$3b2o6bobo$11bobo$12bo$22b2o$23bo$6b2o12b3o$6b2o12bo$21b2o$22bo$21bo$21b2o!")
pond_cp_SWSE = g.parse("9bo$8bobo$9bo2$7b5o$6bo4bo$5bo2bo7bo$5bob2o7b3o$2b2obo5bo7bo$2b2obo4bobo5b2o$5b2o2bo2bo$5bo4b2o$3bobo$b3ob2o$o47b2o$b3ob2o41bo$3bob2o12b2o25bobo$18bo2bo24b2o$18bo2bo$19b2o6$26b2o$26bo$27b3o$29bo$21b2o4b2o$17b2o3bo4bo$16bobo2bo3bobo$17bo4b5o$18b4o$21bob2o$20bo2bobo$20b2o2bo!")
slideNE = g.parse("9b2o$8bobo$2b2o4bo$3bo2b2ob4o$3bobobobo2bo$2obobobobo$2obobob2o$4bo2$17b2o$8b2o7bo$8b2o5bobo$15b2o7$5b2o$6bo$3b3o$3bo$27b2o$27b2o$31bo$11b2o14b5o$12bo13bo$12bobo12b3o$13b2o15bo$27b4o$22b2o3bo3b2o$22b2o4b3o2bo$30bob2o$30bo$29b2o3$21b2o$21bo$22b3o$24bo!")
slideNE9 = g.parse("9b2o$8bobo$2b2o4bo$3bo2b2ob4o$3bobobobo2bo$2obobobobo$2obobob2o$4bo2$17b2o$8b2o7bo$8b2o5bobo$15b2o7$5b2o$6bo$3b3o$3bo3$29b2o$29b2o$33bo$13b2o14b5o$14bo13bo$14bobo12b3o$15b2o15bo$29b4o$24b2o3bo3b2o$24b2o4b3o2bo$32bob2o$32bo$31b2o3$23b2o$23bo$24b3o$26bo!")
slideNE10 = g.parse("9bo$8bobo$6b3obo$5bo4bob2o$5bobobobobo$2o4b2obobo$bo8bobo5b2o$bobo7bo6b2o$2b2o3$13b2o$12bo2bo$13b2o6$5b2o$5bobo10b2o$6b2o10bobob2o$16bobob2obo18b2o$4b4o3b2o3b2o24bo$3bo2bo4b2o31bo$3b2o3bo15b2o14b5o$7b2o16bo13bo$25bobo12b3o$26b2o15bo$40b4o$35b2o3bo3b2o$35b2o4b3o2bo$43bob2o$43bo$42b2o3$34b2o$34bo$35b3o$37bo!")
# Gliders (special ordering)
glider = dict()
glider[0] = g.parse("2bo$obo$b2o!")
glider[1] = g.parse("bo$2bo$3o!")
glider[2] = g.parse("obo$b2o$bo!")
glider[3] = g.parse("o$b2o$2o!")
# Loafer Eater (component for the Eater Wall).
loaf_eater = g.parse("3b2o$3bo$bobo$b2o7$2o$2o!")
y_loafeater = 228 # Don't need the X coordinate as it will be compute later.
h_loafeater_minus = 11
# Computed needed datas
# Reflectors and Slides
snark_SWSE = g.transform(snark_NWNE, 0, 18, 1, 0, 0, -1)
snark64_SWSE = g.transform(snark64_NWNE, 0, 23, 1, 0, 0, -1)
slideSW = g.transform(g.transform(slideNE, 0, 0, 0, -1, -1, 0), 0, 0, -1, 0, 0, -1)
# 11 Top Guns + 11 Bottom Guns - top and bottom gun are 133 ticks delayed.
gun_bottom = []
gun_bottom.append(p154G_Loafer)
gun_top = []
gun_top.append(g.evolve(gun_bottom[0], 133))
for i in range(10):
gun_bottom.append(g.evolve(gun_bottom[i], 98))
gun_top.append(g.evolve(gun_top[i], 98))
h_gun = max(p154G_Loafer[1::2]) - min(p154G_Loafer[1::2])
# Gliders + 133 ticks - for Top Guns
glider133 = []
for i in range(4):
glider133.append(g.evolve(glider[i], 133))
### Main Program ###
## Find loop type and set the starting variables.
loop_base = []
if (w-7)%4==0: # Loop type 7 + 4n bits - slideNE old values 89, 18
loop_base = [ [snark_NWNE, 87, 53], [slideNE, 82, 25], [snark_SWSE, 50, 49] ] # NE slide is at 0 shift ==> do not fit the Basic Loop.
insLoc = (58, -13) # Inserter Location.
gLoc = [31, -45] # First Glider of stream location.
g_ph = 0 # Glider phase.
n_extend = (w-7)//4 # Extension factor from Basic Loop.
first_slide_max_shift = 88 # Shift from 0 of NE slide of 'loop_base' to fit Basic Loop.
slideNE_max_shift = 131 # Maximum shift from 0 for NE slides. (old value = 124)
last_slideSW_shift = 0 # The last SW slide can be not at shift 0 due to the last SW-SE reflector.
adjust_shift = 49 # Shift to adjust the timing of orthogonal lane and reflectors consuming.
slideNE_diff_X, slideNE_diff_Y = 0, 0 # Positioning adjustment of NE slide of 'loop_base' due to its bounding box (type of reflectors used).
elif (w-8)%4==0:
loop_base = [ [snark64_NWNE, 94, 46], [slideNE, 90, 17], [snark64_SWSE, 57, 51] ]
insLoc = (56, -11)
gLoc= [22, -49]
g_ph=1
n_extend = (w-8)//4
first_slide_max_shift = 64
slideNE_max_shift = 123
last_slideSW_shift = 8
adjust_shift = 57
slideNE_diff_X, slideNE_diff_Y = 0, 0
elif (w-9)%4==0:
loop_base = [ [snark_NWNE, 87, 53], [slideNE9, 94, 9], [pond_cp_SWSE, 36, 45] ]
insLoc = (52, -11)
gLoc = [50, -18]
g_ph = 0
n_extend = (w-9)//4
first_slide_max_shift = 58
slideNE_max_shift = 110
last_slideSW_shift = 8
adjust_shift = 63
slideNE_diff_X, slideNE_diff_Y = 2, 2
elif (w-10)%4==0:
loop_base = [ [snark64_NWNE, 94, 46], [slideNE10, 76, 19], [pond_cp_SWSE, 32, 41] ]
insLoc = (48, -15)
gLoc = [50, -18]
g_ph = 0
n_extend = (w-10)//4
first_slide_max_shift = 37
slideNE_max_shift = 116
last_slideSW_shift = 0
adjust_shift = 56
slideNE_diff_X, slideNE_diff_Y = 13, -1
## Compute needed slide number and their relative shifts.
nb_slide = 0 # Number of NE+SW slides.
before_last_shift = 0 # Shift of first last NE slide (in order to adjust it if the 'adjust_shift' is too high to fit the right length loop).
last_shift = 0 # Shift of last NE slide to fit the right length loop.
min_shift = n_extend*77 - first_slide_max_shift
nb_slide = (min_shift if min_shift>0 else -1)//(slideNE_max_shift + adjust_shift) + 1
last_shift = slideNE_max_shift - first_slide_max_shift - nb_slide*(slideNE_max_shift + adjust_shift) + n_extend*77
if last_slideSW_shift > 0 and nb_slide > 0:
last_shift += last_slideSW_shift
if last_shift > slideNE_max_shift:
nb_slide += 1
last_shift = last_shift - slideNE_max_shift - adjust_shift
if last_shift <0:
before_last_shift = - last_shift
last_shift = 0
## Compute Trombones Slides list
trb_sld = []
adjustNE, adjustSW = 0, 0
for i in range(nb_slide):
if i == nb_slide - 1:
adjustNE = before_last_shift
adjustSW = last_slideSW_shift
x = slideNE_max_shift - 33*i - adjustNE + slideNE_diff_X
y = -slideNE_max_shift - 33*i + adjustNE + slideNE_diff_Y
trb_sld.append([slideNE, loop_base[1][1] + x, loop_base[1][2] + y])
trb_sld.append([slideSW, 45 - 33*i + adjustSW, 29 - 33*i - adjustSW]) # 45,29 = 1rst SW slide position.
trb_sld.append([loop_base[1][0], loop_base[1][1] + last_shift - 33*nb_slide, loop_base[1][2] - last_shift - 33*nb_slide])
# Maximum last NE slides adjusting
if nb_slide > 0:
h1 = trb_sld[-1][2]
h2 = trb_sld[-3][2]
n = 1
while h1 - h2 >= 2 * n - 1:
shift_h1 = h1 - (n * h1 + h2) // (n + 1) # Barycentre
shift_h2 = n * shift_h1
for i in range(len(trb_sld)-1, len(trb_sld)-2*n, -2):
trb_sld[i][1] = trb_sld[i][1] + shift_h1
trb_sld[i][2] = trb_sld[i][2] - shift_h1
trb_sld[i-2][1] = trb_sld[i-2][1] - shift_h2
trb_sld[i-2][2] = trb_sld[i-2][2] + shift_h2
h1 = max(h1 - shift_h1, h2 + shift_h2)
if i > 3:
h2 = trb_sld[i-4][2]
else:
break
n += 1
## Compute the final loop for the leftmost gun
boucle = g.transform(loop_base[0][0], loop_base[0][1], loop_base[0][2])
for elem in trb_sld:
boucle = g.join(boucle, g.transform(elem[0], elem[1], elem[2]))
boucle = g.join(boucle, g.transform(loop_base[2][0], loop_base[2][1] - 33*nb_slide , loop_base[2][2] - 33*nb_slide))
boucle = g.join(boucle, g.transform(ins, insLoc[0] - 33*nb_slide, insLoc[1] - 33*nb_slide))
h_boucle = max(boucle[1::2]) - min(boucle[1::2])
## Compute the BitMap Printer with external Gliders streams
output = []
wall = []
top_gun, bottom_gun = 0, 0 # Integers to compute the initialisation ticks
is_top_gun, is_bottom_gun = False, False # Booleans to compute the putting cells
is_top_eater, is_bottom_eater = False, False # idem
top_x_offset, bot_x_offset = -1, -1 # Intergers to compact the Printer
aTop_offset, aBot_offset = [], [] # Compact offset arrays use to delete inserters.
for i in range(0, (h+1)//2):
l_inf = (h+1)//2 + i
l_sup = (h+1)//2 - i - 1
is_bottom_gun = more_gun("bottom", l_inf)
if is_bottom_gun:
bottom_gun += 1
is_top_gun = more_gun("top", l_sup)
if is_top_gun:
top_gun += 1
# Superior row
# Gun + Loop + Inserter + Gliders Stream for top line
if row_sum[l_sup] > 0:
aTop_offset.append(i - top_x_offset - 1)
x_offset = 308*sum(aTop_offset)
output = g.join(output, put_part("top", i, l_sup, [gun_top[i%11], 0], [boucle, 0, nb_slide], [glider133, gLoc, g_ph], x_offset))
top_x_offset = i
# Loafer Eater for top line (indent this part of code to get a discontinuous Eater Wall)
if dist>0 and ( bottom_gun==0 and (row_sum[l_sup]>0 or is_top_eater) or bottom_gun>0):
y = y_loafeater - 25 * i
wall= g.join(wall, g.transform(loaf_eater, 0 , y))
is_top_eater = True
# Inferior row
if l_inf < h:
# Gun + Loop + Inserter + Gliders Stream for bottom line
if row_sum[l_inf] > 0:
aBot_offset.append(i - bot_x_offset - 1)
x_offset = 308*sum(aBot_offset)
output = g.join(output, put_part("bottom", i, l_inf, [gun_bottom[i%11], h_gun-1], [boucle, h_boucle-1, nb_slide], [glider, gLoc, g_ph], x_offset))
bot_x_offset = i
# Loafer Eater for bottom line (indent this part of code to get a discontinuous Eater Wall)
if dist > 0 and (top_gun==0 and (row_sum[l_inf]>0 or is_bottom_eater) or top_gun>0 and is_bottom_gun):
y = y_loafeater + h_loafeater_minus + 25 * (i+1) + 4
wall = g.join(wall, g.transform(loaf_eater, 0 , y, 1, 0, 0, -1))
is_bottom_eater = True
# Values for next round
gLoc[0] += -14 - 2156//4
gLoc[1] -= +14 + 2156//4
### Put The BitMap Printer + Inserters + External Input Streams on a new layer
msg2 = "Constructing the default BitMap Printer on the new layer … "
g.show(str(msg1) + str(msg2))
g.addlayer()
g.new(str(w) + "-by-" + str(h) + " p154 Loafer BitMap Printer")
### Run and send to user an initialised BitMap Printer
if init == "+":
msg2 = "Initialising the BitMap Printer …"
g.show(str(msg1) + str(msg2))
if (top_gun - sum(aTop_offset)) <= (bottom_gun - sum(aBot_offset)):
n_guns = bottom_gun - sum(aBot_offset)
offset = sum(aBot_offset)
bot_adj = 195
else:
n_guns = top_gun - sum(aTop_offset)
offset = sum(aTop_offset)
bot_adj = 0
lg_guns = n_guns*316 + bot_adj + 8*offset
run = 7 * (lg_guns + 107 +(33*nb_slide)//77*44)
g.putcells(output, 0, 0)
g.run(run) # Run until reach Printer's border
rect =g.getrect()
g.run(w * 154)
g.select(rect)
g.clear(1)
## Now delete the inserters
ins2del = []
it, ib = 0, 0
for i in range(0, (h+1)//2):
l = (h+1)//2-i-1
if sum(row[l]) > 0:
it += 1
x, y = xy_fit("top", insLoc[0] - 33*nb_slide - sum(aTop_offset[:it])*308, insLoc[1] - 33*nb_slide, i, 0)
ins2del = g.join(ins2del, g.transform(ins, x, y, 1, 0, 0, 1))
l = (h+1)//2 + i
if l < h:
if sum(row[l]) > 0:
ib += 1
x, y = xy_fit("bottom", insLoc[0] - 33*nb_slide - sum(aBot_offset[:ib])*308, insLoc[1] - 33*nb_slide, i, h_ins_minus)
ins2del = g.join(ins2del, g.transform(ins, x, y + h_ins_minus, 1, 0, 0, -1))
g.putcells(ins2del, 0, 0, 1, 0, 0, 1, "xor")
g.select(rect)
output = g.getcells(rect)
g.clear(0)
g.select([])
# Add the Eater Wall if required.
if dist > 0:
x_max = max(output[::2])
x_wall = x_max + (dist*w*22) // 100 + 2
output = g.join(output, g.transform(wall, x_wall, 0))
g.putcells(output, 0, 0, t[0], t[1], t[2] , t[3])
g.setgen("0")
g.fit()
g.show("Just run your ticker now :)")
Enjoy ! I feel the script is finished.
Of course, some optimizations can be done and surely it can be rewritten with a better code …
A NW-SW Snark selected with 3 empty upper lines and some spaces at left (46x26), user string input = R+100
.
Strangely enough, as it happens in the first version of the script in this thread, no one has reported this error, as if this Glider was never used.