From 7f6ac272c3f5a3f69e9dac0910e30a00d3d1a929 Mon Sep 17 00:00:00 2001 From: = <=> Date: Tue, 6 Feb 2024 17:35:40 +0100 Subject: [PATCH] main should be done for real testing for now --- python/main.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/python/main.py b/python/main.py index d91ef30..32f4a38 100644 --- a/python/main.py +++ b/python/main.py @@ -1,9 +1,12 @@ from polycube import PolyCube +from polycube_encoder import PolyCubeEncdoder import json def main(maxlength:int): - polycubes = {} + polycubes = set([PolyCube([(0, 0, 0)], [(0, 0, 0)])]) + n_size = [0]*maxlength todo = [PolyCube([(0, 0, 0)], [(0, 0, 0)])] + n_size[0] = 1 while len(todo) != 0: polycube = todo.pop() children = polycube.generate_children(maxlength) @@ -11,9 +14,12 @@ def main(maxlength:int): if child in polycubes: continue todo.append(child) - polycubes[child] = 0 + polycubes.add(child) + n_size[len(child.cubes)-1] += 1 with open("out.json", "w") as f: - f.write(json.dumps(polycubes)) + f.write(json.dumps(polycubes, cls=PolyCubeEncdoder)) + with open("count.json", "w") as f: + f.write(json.dumps(n_size)) if __name__ == "__main__": main(4)