Commit a732d2d7 authored by Christian Wander's avatar Christian Wander
Browse files

working toward snakeify

parent 030e12d5
......@@ -11,12 +11,73 @@ def pretty_print(thing, w, h):
print()
n = 0
def console_print(thing):
for line in thing:
for item in line:
#print(sum(item), end=" ")
print("{0:3d}".format(sum(item)), end='')
print()
def snakify(thing):
"""Returns the snakified strip
Expects a 2dim array of tuples!!1
"""
result = []
line_no = 0
for line in thing:
if line_no % 2 == 0:
# even line number? append normally
result.append(line)
else:
# odd line number? append the line reversed!
result.append(line[::-1])
line_no += 1
return result
# wtf
def heart_tuple(color):
o = (0, 0, 0)
x = color
return [[o, x, x, x, x, o, o, x, x, x, x, o], \
[x, x, x, x, x, x, x, x, x, x, x, x], \
[x, x, x, x, x, x, x, x, x, x, x, x], \
[x, x, x, x, x, x, x, x, x, x, x, x], \
[x, x, x, x, x, x, x, x, x, x, x, x], \
[x, x, x, x, x, x, x, x, x, x, x, x], \
[o, x, x, x, x, x, x, x, x, x, x, o], \
[o, x, x, x, x, x, x, x, x, x, x, o], \
[o, o, x, x, x, x, x, x, x, x, o, o], \
[o, o, o, x, x, x, x, x, x, o, o, o], \
[o, o, o, o, x, x, x, x, o, o, o, o], \
[o, o, o, o, o, x, x, o, o, o, o, o]]
def eck_tuple(color):
o = (0, 0, 0)
x = color
return [[x, o, o, o, o, o, o, o, o, o, o, o], \
[x, x, o, o, o, o, o, o, o, o, o, o], \
[x, x, x, o, o, o, o, o, o, o, o, o], \
[x, x, x, x, o, o, o, o, o, o, o, o], \
[x, x, x, x, x, o, o, o, o, o, o, o], \
[x, x, x, x, x, x, o, o, o, o, o, o], \
[x, x, x, x, x, x, x, o, o, o, o, o], \
[x, x, x, x, x, x, x, x, o, o, o, o], \
[x, x, x, x, x, x, x, x, x, o, o, o], \
[x, x, x, x, x, x, x, x, x, x, o, o], \
[x, x, x, x, x, x, x, x, x, x, x, o], \
[x, x, x, x, x, x, x, x, x, x, x, x]]
def heart(color):
......@@ -57,12 +118,26 @@ def eck(color):
if __name__ == "__main__":
print(">> blinktest")
# print(f'eck: \n{eck((3, 3, 3))}')
# print(f'heart: \n{heart((3, 3, 3))}')
# print(desnake((1, 2, 3)))
print(">> blinktest")
color = (127, 127, 127)
# console_print(eck_tuple(color))
print(">>")
console_print(snakify(eck_tuple(color)))
# heart = heart(color)
#
# print("heart:")
# pretty_print(heart, 12, 12)
#
# print("heart snakified:")
# pretty_print(snakify(heart), 12, 12)
#
# print("eck:")
# pretty_print(eck(color), 12, 12)
#
# print("eck snakified:")
# pretty_print(snakify(eck(color)), 12, 12)
pretty_print(heart((1, 2, 3)), 12, 12)
\ No newline at end of file
......@@ -37,7 +37,6 @@ def main():
for c in colors:
sender[universe].dmx_data = eck(c)
time.sleep(5)
# sender[universe].dmx_data = (5, 6, 7, 8)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment