add blacklisting

This commit is contained in:
2024-08-24 18:11:59 +03:00
parent f012c0536f
commit 473adc64b8
4 changed files with 106 additions and 44 deletions

View File

@ -38,7 +38,8 @@ def get_first_n_from_generator(gen: Generator[Any, None, Any], n: int) -> List[A
try:
while len(results) < n:
item = next(gen)
results.append(item)
if item not in results:
results.append(item)
except StopIteration:
pass
return results
@ -66,12 +67,12 @@ def main():
# TODO: make this function a method of an object that contains a list of finger tricks
score_func = lambda solution: sum(ft.score() for ft in solution.finger_tricks)
data = defaultdict(list)
eolrb_states, n_states = eolrb_states_generator(
list(EOLROrientation), EOLR_PERMUTATIONS
)
# eolrb_states, n_states = eolrb_states_generator(
# [EOLROrientation.Solved], [EOLRPermutation(UR="UR", UL="UL")]
# list(EOLROrientation), EOLR_PERMUTATIONS
# )
eolrb_states, n_states = eolrb_states_generator(
[EOLROrientation.OneOne], EOLR_PERMUTATIONS
)
for i, (eolrb_cube, ori, perm, pre_auf) in enumerate(eolrb_states):
print(
f"generating algs for {ori.name} (UR in {perm.UR}, UL in {perm.UL}, pre AUF {pre_auf}) ({i}/{n_states})"
@ -121,7 +122,7 @@ def main():
}
)
with open("output.json", "w") as f:
f.write(json.dumps(data))
f.write(json.dumps(data, indent=4))
if __name__ == "__main__":