1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #!/usr/bin/python3
-
- import sys
-
- size = 64
-
- if len(sys.argv) != 1:
- size = int(sys.argv[1])
-
- start = [1, 2]
-
- output = []
-
- def nextRow(prevRow):
- list = []
- list.append(prevRow[0])
- for x in range(0, len(prevRow) - 1):
- list.append((prevRow[x] + prevRow[x+1]) % 4)
- list.append(prevRow[len(prevRow) - 1])
- return list
-
- output.append(start)
- last = start
- for x in range(0, size):
- y = nextRow(last)
- output.append(y)
- last = y
-
- max = len(output[len(output) - 1])
-
- #for arry in output:
- # print(arry)
-
- for x in range(0, len(output)):
- for y in range(0, len(output[x])):
- if output[x][y] == 0:
- print("\033[31m{}\033[0m".format(output[x][y]), end=" ")
- elif output[x][y] == 1:
- print("\033[92m{}\033[0m".format(output[x][y]), end=" ")
- elif output[x][y] == 2:
- print("\033[96m{}\033[0m".format(output[x][y]), end=" ")
- else:
- print("\033[93m{}\033[0m".format(output[x][y]), end=" ")
- print()
|