Skip to content

Instantly share code, notes, and snippets.

@atoponce
Last active December 29, 2020 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atoponce/538ba56c67e6fce90338108e7306c072 to your computer and use it in GitHub Desktop.
Save atoponce/538ba56c67e6fce90338108e7306c072 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
def _rot90(num):
counter = 0
bits = "{:09b}".format(num)
tmp = list(bits)
for idx in [6,3,0,7,4,1,8,5,2]:
tmp[idx] = bits[counter]
counter += 1
return int(''.join(tmp), 2)
def main():
result = []
for i in range(2**9):
r1 = _rot90(i)
r2 = _rot90(r1)
r3 = _rot90(r2)
uniques = list(set([i, r1, r2, r3]))
uniques.sort()
if len(uniques) == 4:
tile = uniques[0]
if tile == i:
result.append(tile)
print(result)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment