fixed import and infinite growth

This commit is contained in:
=
2024-02-06 17:02:16 +01:00
parent d0b161bfaa
commit 644ba22d1b
2 changed files with 19 additions and 5 deletions

View File

@@ -1,6 +1,19 @@
from polycube import PolyCube
import json
def main():
pass
def main(maxlength:int):
polycubes = {}
todo = [PolyCube([(0, 0, 0)], [(0, 0, 0)])]
while len(todo) != 0:
polycube = todo.pop()
children = polycube.generate_children(maxlength)
for child in children:
if child in polycubes:
continue
todo.append(child)
polycubes[child] = 0
with open("out.json", "w") as f:
f.write(json.dumps(polycubes))
if __name__ == "__main__":
main()
main(4)