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

apply formatting

parent d94c44d3
......@@ -2,11 +2,11 @@ PINK = (255, 0, 255)
LIGHTBLUE = (0, 255, 255)
BLUE = (0, 0, 255)
class Thing:
def __init__(self, matrix):
self.matrix = matrix
def console_print(self):
"""Prints the pixel matrix in this object to the console.
......@@ -16,15 +16,13 @@ class Thing:
for item in line:
print("{0:3d}".format(sum(item)), end='')
print()
def snake_tuple(self):
"""Returns a tuple, where the pixels in every 2nd line are in reverse order.
"""
return self.tuplify(self.snakify())
return self.tuplify(self.snakify())
def snakify(self):
"""Returns the snakified pixel matrix.
......@@ -48,7 +46,6 @@ class Thing:
return result
@staticmethod
def tuplify(matrix):
"""Returns one tuple with rgb values
......@@ -65,15 +62,15 @@ class Thing:
return tuple(result)
def from_heart(color = PINK):
def from_heart(color=PINK):
"""
Creates an Thing object that contains a heart
"""
return Thing(heart_tuple(color))
def from_eck(color = PINK):
def from_eck(color=PINK):
"""
Creates a Thing object that contains an eck
"""
......@@ -85,17 +82,17 @@ 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], \
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]]
......@@ -104,30 +101,30 @@ 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], \
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]]
if __name__ == "__main__":
print(">> blinktest")
print(">> blinktest")
color = (127, 127, 127)
color = (127, 127, 127)
# print(">>")
# console_print(snakify(eck_tuple(color)))
# print(tuplify(eck_tuple(color)))
t = from_heart();
t = from_heart()
print(t.console_print())
print(t.snake_tuple())
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