-
-
Save zeffii/f8cfc8124079610fbb16 to your computer and use it in GitHub Desktop.
This file contains 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
# variations of incomplete cube | |
import itertools | |
import random | |
def shift2(tup): | |
return tuple(list(tup[-2:]) + list(tup[:-2])) | |
n = 12 | |
k = list(itertools.product(*[(0, 1)] * n)) | |
items = [i for i in k if sum(i) >= 3 and sum(i) <= 11] | |
items2 = [] | |
# don't store rotated versions | |
for i in items: | |
a = shift2(i) | |
b = shift2(a) | |
c = shift2(b) | |
d = shift2(c) | |
e = shift2(d) | |
t = [(op in items2) for op in [i, a, b, c, d, e]] | |
found_any = any(t) | |
if not found_any: | |
items2.append(i) | |
titems = [] | |
titems2 = [] | |
for i in items2: | |
if random.random() > 0.8: | |
titems.append(i) | |
tup_as_string = ''.join([str(h) for h in i]) | |
converted = int(tup_as_string, 2) | |
titems2.append(converted) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment