main should be done for real testing for now
This commit is contained in:
@@ -1,9 +1,12 @@
|
|||||||
from polycube import PolyCube
|
from polycube import PolyCube
|
||||||
|
from polycube_encoder import PolyCubeEncdoder
|
||||||
import json
|
import json
|
||||||
|
|
||||||
def main(maxlength:int):
|
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)])]
|
todo = [PolyCube([(0, 0, 0)], [(0, 0, 0)])]
|
||||||
|
n_size[0] = 1
|
||||||
while len(todo) != 0:
|
while len(todo) != 0:
|
||||||
polycube = todo.pop()
|
polycube = todo.pop()
|
||||||
children = polycube.generate_children(maxlength)
|
children = polycube.generate_children(maxlength)
|
||||||
@@ -11,9 +14,12 @@ def main(maxlength:int):
|
|||||||
if child in polycubes:
|
if child in polycubes:
|
||||||
continue
|
continue
|
||||||
todo.append(child)
|
todo.append(child)
|
||||||
polycubes[child] = 0
|
polycubes.add(child)
|
||||||
|
n_size[len(child.cubes)-1] += 1
|
||||||
with open("out.json", "w") as f:
|
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__":
|
if __name__ == "__main__":
|
||||||
main(4)
|
main(4)
|
||||||
|
|||||||
Reference in New Issue
Block a user