Code: Select all
# salvo-bender.py
# Goldtiger997, July 2018
import golly as g
# Input this list from salvo-rle-to-position-list.py
salvo = [40, 41, 35, 41, 44, 44, 44, 44, 41, 43, 40, 35, 41, 41, 38, 39, 41, 42, 43, 43, 40, 42, 37, 36, 38, 34, 33, 33, 35, 35, 30, 31, 31, 37, 30, 18, 24, 23, 23, 21, 22, 18, 18, 21, 20, 23, 25, 25, 21, 19, 19, 22, 26, 24, 22, 20, 20, 23, 27, 25, 23, 21, 21, 24, 18, 20, 22, 24, 24, 21, 17, 21, 23, 23, 20, 19, 16, 15, 15, 17, 17, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 9, 6, 6, 13, 7, 13, 12, 12, 9, 9, 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 27, 24, 24, 31, 25, 31, 30, 30, 27, 27, 36, 35, 37, 34, 34, 32, 31, 30, 30, 33, 31, 31, 30, 29, 29, 32, 30, 35, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 28, 30, 18, 24, 23, 23, 21, 22, 18, 18, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 17, 20, 14, 14, 17, 10, 12, 0, 6, 5, 5, 3, 4, 0, 0]
x = 0
y = 0
fire = [g.parse("11$2o$bo$2o!"), "No", 1, 1]
push1 = [g.parse("2$20b2o8b2o$2o19bo9bo$bo18b2o8b2o$2o3$10b2o$11bo$10b2o!"), g.parse("2$10b2o$11bo$10b2o3$2o$bo18b2o8b2o$2o19bo9bo$20b2o8b2o!"), 4, 0]
push2 = [g.parse("2$2o8b2o18b2o8b2o$bo9bo19bo9bo$2o8b2o18b2o8b2o2$20b2o$21bo$20b2o!"), g.parse("4$20b2o$21bo$20b2o2$2o8b2o18b2o8b2o$bo9bo19bo9bo$2o8b2o18b2o8b2o!"), 5, 0]
push3 = [g.parse("5$2o$bo$2o!"), g.parse("5$2o$bo$2o!"), 1, 0]
push4 = [g.parse("4$2o$bo$2o!"), g.parse("6$2o$bo$2o!"), 1, 1]
pull1 = [g.parse("10b2o8b2o8b2o$2o9bo9bo9bo$bo8b2o8b2o8b2o38b2o$2o69bo$70b2o$40b2o$41bo$40b2o$50b2o8b2o$51bo9bo$50b2o8b2o!"), g.parse("2$50b2o8b2o$51bo9bo$50b2o8b2o$40b2o$41bo$40b2o$70b2o$2o69bo$bo8b2o8b2o8b2o38b2o$2o9bo9bo9bo$10b2o8b2o8b2o!"), 8, 4]
pull2 = [g.parse("10b2o8b2o$2o9bo9bo$bo8b2o8b2o38b2o$2o59bo$60b2o$30b2o$31bo$30b2o$40b2o8b2o$41bo9bo$40b2o8b2o!"), g.parse("2$40b2o8b2o$41bo9bo$40b2o8b2o$30b2o$31bo$30b2o$60b2o$2o59bo$bo8b2o8b2o38b2o$2o9bo9bo$10b2o8b2o!"), 7, 4]
pull3 = [g.parse("10b2o$2o9bo$bo8b2o38b2o$2o49bo$50b2o$20b2o$21bo$20b2o$30b2o8b2o$31bo9bo$30b2o8b2o!"), g.parse("2$30b2o8b2o$31bo9bo$30b2o8b2o$20b2o$21bo$20b2o$50b2o$2o49bo$bo8b2o38b2o$2o9bo$10b2o!"), 6, 4]
pull4 = [g.parse("$2o$bo38b2o$2o39bo$40b2o$10b2o$11bo$10b2o$20b2o8b2o$21bo9bo$20b2o8b2o!"), g.parse("2$20b2o8b2o$21bo9bo$20b2o8b2o$10b2o$11bo$10b2o$40b2o$2o39bo$bo38b2o$2o!"), 5, 4]
pull5 = [g.parse("10b2o$11bo$10b2o28b2o8b2o$41bo9bo$2o28b2o8b2o8b2o$bo29bo$2o28b2o2$20b2o$21bo$20b2o!"), g.parse("2$20b2o$21bo$20b2o2$2o28b2o$bo29bo$2o28b2o8b2o8b2o$41bo9bo$10b2o28b2o8b2o$11bo$10b2o!"), 6, 1]
#format is [rle that pushes up, rle that pushes down, number of Gs invloved, upward push distance]
pushes = [push1, push2, push3, push4]
pulls = [pull1, pull2, pull3, pull4, pull5]
def getPullSequence(n):
seq = []
if n in range(1,5):
seq = [n]
elif n in range(6,9):
seq = [4, n-4]
else:
fours = (0-n)%5
for i in range(0,fours):
seq.append(4)
for i in range(0,(n - 4 * fours)/5):
seq.append(5)
return seq
def getPushSequence(n):
if n == 1:
seq = [1]
else:
seq = [2]
for i in range(1,n):
seq.append(3)
seq.append(4)
return seq
def placeGs(value):
global x
global y
if value == "fire":
sequence = [1]
p = [fire]
elif value > 0:
sequence = getPullSequence(value)
p = pulls
elif value < 0:
sequence = getPushSequence(0-value)
p = pushes
else:
sequence = [];
p = []
for item in sequence:
if y > -4 or len(p) == 1:
direction = 0
else:
direction = 1
x -= p[item-1][2]*10
g.putcells(p[item-1][direction], x, y, 1, 0, 0, 1, "or")
y += (p[item-1][3]) * (2*direction - 1)
i = len(salvo) - 1
while i > 0:
placeGs("fire")
x -= 10
placeGs(salvo[i] - salvo[i-1])
i -= 1
placeGs("f")
g.putcells(g.parse("$3bo$b5o$bo3bo$2obob2o$bo3bo$b5o$3bo!"), 0, 2, 1, 0, 0, 1, "or")
To use it you first need to run salvo-rle-to-position-list.py (my previous script) to generate the position list for the salvo you want to convert. Paste the result into the "salvo" variable. Run it in Golly, and hopefully it works!
Using the list from my above post gave this output very quickly (but I has to add the target snowflake in the south):
It's too big for LifeViewer, but it works well in Golly at 10^2.