A thing.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.py 1000B

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