Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- positions = [0, 1, 2, 5, 6, 7, 10, 11, 12]
- rotations = [
- [0, 1, 2, 3, 4, 5, 6, 7, 8],
- [2, 5, 8, 1, 4, 7, 0, 3, 6],
- [8, 7, 6, 5, 4, 3, 2, 1, 0],
- [6, 3, 0, 7, 4, 1, 8, 5, 2],
- ]
- shapes = set()
- for n in range(1, 2**9):
- rotated = []
- for rot in rotations:
- shape = 0
- for bit, pos in zip(rot, positions):
- if n & (1 << bit):
- shape += 1 << pos
- while shape and not (shape & 1):
- shape >>= 1
- rotated.append(shape)
- shapes.add(min(rotated))
- for shape in sorted(shapes):
- print bin(shape)
- print len(shapes)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement