|
@@ -0,0 +1,44 @@
|
|
1
|
+#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+import sys
|
|
4
|
+
|
|
5
|
+size = 64
|
|
6
|
+
|
|
7
|
+if len(sys.argv) != 1:
|
|
8
|
+ size = int(sys.argv[1])
|
|
9
|
+
|
|
10
|
+start = [1, 2]
|
|
11
|
+
|
|
12
|
+output = []
|
|
13
|
+
|
|
14
|
+def nextRow(prevRow):
|
|
15
|
+ list = []
|
|
16
|
+ list.append(prevRow[0])
|
|
17
|
+ for x in range(0, len(prevRow) - 1):
|
|
18
|
+ list.append((prevRow[x] + prevRow[x+1]) % 4)
|
|
19
|
+ list.append(prevRow[len(prevRow) - 1])
|
|
20
|
+ return list
|
|
21
|
+
|
|
22
|
+output.append(start)
|
|
23
|
+last = start
|
|
24
|
+for x in range(0, size):
|
|
25
|
+ y = nextRow(last)
|
|
26
|
+ output.append(y)
|
|
27
|
+ last = y
|
|
28
|
+
|
|
29
|
+max = len(output[len(output) - 1])
|
|
30
|
+
|
|
31
|
+#for arry in output:
|
|
32
|
+# print(arry)
|
|
33
|
+
|
|
34
|
+for x in range(0, len(output)):
|
|
35
|
+ for y in range(0, len(output[x])):
|
|
36
|
+ if output[x][y] == 0:
|
|
37
|
+ print("\033[31m{}\033[0m".format(output[x][y]), end=" ")
|
|
38
|
+ elif output[x][y] == 1:
|
|
39
|
+ print("\033[92m{}\033[0m".format(output[x][y]), end=" ")
|
|
40
|
+ elif output[x][y] == 2:
|
|
41
|
+ print("\033[96m{}\033[0m".format(output[x][y]), end=" ")
|
|
42
|
+ else:
|
|
43
|
+ print("\033[93m{}\033[0m".format(output[x][y]), end=" ")
|
|
44
|
+ print()
|