Vacuum gun! Though I wish the script could adjust the period of a gun with the help of snarks...
Thanks. I have experience from UnrealScript so this should be no surprise.
Also, how much should I offset the gun so that the output line up with the selected glider?
This is the current code. Rotate will misalign the output and the input!
Code: Select all
import golly as g
rot = int(g.getstring('How many times to rotate 90 degrees clockwise from southeast direction? Inputting a non-number character will result in error!'))
def positionGun():
if len(g.getselrect()) == 0:
nos()
elif rot < 0:
nos2()
else:
placeGun(g.getselrect())
def placeGun(gpos):
g.putcells([-92, -60, -91, -60, -67, -60, -66, -60, -92, -59, -91, -59, -67, -59, -69, -58, -67, -58, -69, -57, -68, -57, -93, -56, -92, -56, -84, -56, -83, -56, -93, -55, -92, -55, -85, -55, -84, -55, -84, -54, -83, -54, -82, -54, -81, -54, -80, -54, -83, -53, -82, -53, -81, -53, -80, -53, -70, -53, -69, -53, -69, -52, -49, -52, -48, -52, -83, -51, -82, -51, -81, -51, -80, -51, -71, -51, -70, -51, -69, -51, -49, -51, -48, -51, -84, -50, -83, -50, -82, -50, -81, -50, -80, -50, -93, -49, -92, -49, -85, -49, -84, -49, -72, -49, -61, -49, -60, -49, -59, -49, -93, -48, -92, -48, -84, -48, -83, -48, -74, -48, -73, -48, -71, -48, -67, -48, -66, -48, -63, -48, -58, -48, -48, -48, -47, -48, -73, -47, -71, -47, -63, -47, -57, -47, -48, -47, -47, -47, -72, -46, -68, -46, -67, -46, -66, -46, -58, -46, -92, -45, -91, -45, -68, -45, -60, -45, -59, -45, -92, -44, -91, -44, -70, -43, -69, -43, -60, -43, -59, -43, -71, -42, -70, -42, -69, -42, -68, -42, -67, -42, -58, -42, -71, -41, -68, -41, -63, -41, -57, -41, -48, -41, -47, -41, -71, -40, -68, -40, -63, -40, -58, -40, -48, -40, -47, -40, -70, -39, -69, -39, -61, -39, -60, -39, -59, -39, -49, -37, -48, -37, -49, -36, -48, -36, -61, -31, -57, -31, -62, -30, -56, -30, -46, -30, -45, -30, -62, -29, -46, -29, -45, -29, -62, -28, -61, -28, -57, -28, -60, -27, -59, -27, -58, -27, -60, -25, -59, -25, -58, -25, -51, -25, -49, -25, -48, -25, -62, -24, -61, -24, -57, -24, -51, -24, -49, -24, -47, -24, -62, -23, -52, -23, -47, -23, -62, -22, -56, -22, -51, -22, -49, -22, -47, -22, -77, -21, -76, -21, -61, -21, -57, -21, -51, -21, -49, -21, -48, -21, -78, -20, -76, -20, -78, -19, -79, -18, -78, -18, -69, -18, -67, -18, -63, -18, -61, -18, -68, -17, -67, -17, -62, -17, -61, -17, -68, -16, -62, -16, -57, -7, -51, -7, -56, -6, -55, -6, -50, -6, -49, -6, -57, -5, -56, -5, -51, -5, -50, -5, -46, 5, -44, 5, -40, 5, -38, 5, -45, 6, -44, 6, -39, 6, -38, 6, -45, 7, -39, 7, -60, 16, -59, 16, -34, 16, -28, 16, -60, 17, -59, 17, -33, 17, -32, 17, -27, 17, -26, 17, -78, 18, -77, 18, -71, 18, -70, 18, -54, 18, -53, 18, -52, 18, -34, 18, -33, 18, -28, 18, -27, 18, -82, 19, -81, 19, -78, 19, -77, 19, -71, 19, -70, 19, -67, 19, -66, 19, -55, 19, -51, 19, -82, 20, -81, 20, -67, 20, -66, 20, -55, 20, -54, 20, -52, 20, -51, 20, -36, 20, -36, 21, -35, 21, -55, 22, -54, 22, -52, 22, -51, 22, -37, 22, -35, 22, -53, 23, -36, 26, -60, 27, -52, 27, -36, 27, -35, 27, -77, 28, -71, 28, -61, 28, -58, 28, -54, 28, -51, 28, -37, 28, -35, 28, -17, 28, -15, 28, -78, 29, -76, 29, -72, 29, -70, 29, -57, 29, -55, 29, -16, 29, -15, 29, -79, 30, -75, 30, -73, 30, -69, 30, -57, 30, -55, 30, -16, 30, -79, 31, -75, 31, -73, 31, -69, 31, -57, 31, -55, 31, -79, 32, -69, 32, -61, 32, -58, 32, -54, 32, -51, 32, -48, 32, -47, 32, -60, 33, -59, 33, -58, 33, -54, 33, -53, 33, -52, 33, -47, 33, -46, 33, -78, 34, -77, 34, -71, 34, -70, 34, -48, 34, -90, 37, -78, 37, -76, 37, -90, 38, -89, 38, -88, 38, -78, 38, -76, 38, -72, 38, -48, 38, -47, 38, -87, 39, -76, 39, -75, 39, -72, 39, -71, 39, -70, 39, -47, 39, -46, 39, -88, 40, -87, 40, -83, 40, -82, 40, -81, 40, -73, 40, -72, 40, -69, 40, -48, 40, -83, 41, -81, 41, -73, 41, -72, 41, -69, 41, -81, 42, -78, 42, -77, 42, -72, 42, -71, 42, -70, 42, -79, 43, -76, 43, -78, 44, -77, 44, -78, 45, -51, 47, -50, 47, -51, 48, -50, 49, -49, 49, -48, 49, -48, 50, -84, 51, -83, 51, -81, 51, -80, 51, -84, 52, -83, 52, -81, 52, -80, 52, -84, 53, -83, 53, -81, 53, -80, 53, -86, 54, -84, 54, -83, 54, -81, 54, -80, 54, -78, 54, -86, 55, -85, 55, -84, 55, -80, 55, -79, 55, -78, 55, -85, 56, -79, 56, -90, 62, -89, 62, -75, 62, -74, 62, -90, 63, -89, 63, -86, 63, -85, 63, -79, 63, -78, 63, -75, 63, -74, 63, -86, 64, -85, 64, -79, 64, -78, 64], gpos[0] + 17, gpos[1] - 28)
g.select([gpos[0] - 76, gpos[1] - 89, 79, 126])
arot = rot
while arot>0:
g.rotate(1)
arot -= 1
def nos():
g.show("Select a glider first!")
def nos2():
g.show("Rotation is invalid! Type 3 for 90-degree counterclockwise.")
positionGun()