Last active
          June 15, 2018 16:16 
        
      - 
      
 - 
        
Save th0rex/e60842166b5b507234cd25431fb39756 to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # [y][x] | |
| rot_table = [ | |
| [0, 1, 62, 28, 27], | |
| [36, 44, 6, 55, 20], | |
| [3, 10, 43, 25, 39], | |
| [41, 45, 15, 21, 8], | |
| [18, 2, 61, 56, 14], | |
| ] | |
| # [y][x] | |
| #res = [[0] * 5] * 5 | |
| res = [[0, 0, 0, 0, 0],[0, 0, 0, 0, 0],[0, 0, 0, 0, 0],[0, 0, 0, 0, 0],[0, 0, 0, 0, 0]] | |
| for x in range(0, 5): | |
| for y in range(0, 5): | |
| offset = rot_table[y][x] | |
| res[(2 * x + 3 * y) % 5][y % 5] = (x, y, offset) | |
| for row in res[::-1]: | |
| print(" & ".join(map(str, row)) + "\\\\ \\hline") | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | from numpy import zeros, int32 | |
| # [x][y][z] | |
| inp = [ | |
| # x = 0 | |
| [ | |
| [0, 1, 1, 1], # y = 4 | |
| [0, 1, 0, 1], | |
| [1, 1, 1, 0], | |
| [0, 0, 0, 0], | |
| [0, 0, 0, 1], # y = 0 | |
| ], | |
| # x = 1 | |
| [ | |
| [0, 0, 0, 1], | |
| [1, 0, 1, 0], | |
| [0, 1, 0, 1], | |
| [1, 0, 0, 1], | |
| [1, 1, 0, 1], | |
| ], | |
| # x = 2 | |
| [ | |
| [0, 0, 1, 0], | |
| [0, 1, 0, 1], | |
| [0, 1, 1, 1], | |
| [0, 1, 0, 1], | |
| [1, 0, 1, 0], | |
| ], | |
| # x = 3 | |
| [ | |
| [1, 0, 1, 0], | |
| [0, 1, 0, 1], | |
| [0, 0, 1, 0], | |
| [0, 1, 0, 1], | |
| [1, 1, 0, 0], | |
| ], | |
| # x = 4 | |
| [ | |
| [0, 1, 1, 1], | |
| [1, 1, 1, 0], | |
| [1, 1, 0, 0], | |
| [0, 1, 1, 1], | |
| [0, 0, 1, 0], | |
| ], | |
| ] | |
| out = zeros((5, 5, 4), dtype=int32) | |
| for x in range(0, 5): | |
| for y in range(0, 5): | |
| for z in range(0, 4): | |
| # Fuck python for not having proper bitwise not | |
| out[x, y, z] = inp[x][y][z] ^ (int(not inp[(x + 1) % 5][y][z]) & inp[(x + 2) % 5][y][z]) | |
| for x in range(0, 5): | |
| print("$x={}$ \\\\ \\begin{{tabular}}{{|c|c|c|c|}}".format(x)) | |
| print("\\hline") | |
| for y in range(0, 5): | |
| print(" & ".join(map(str, out[x, y])) + "\\\\ \\hline") | |
| print("\\end{tabular}\\\\") | |
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment