Last active
December 29, 2020 22:45
-
-
Save atoponce/538ba56c67e6fce90338108e7306c072 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
#!/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