commit 80a412f31c18a2fdf1d56cf9ec817a1d1819de82
parent a82527e00fd535d0740deb45e39d041863116404
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date: Tue, 12 Aug 2025 15:20:16 +0200
Small improvemen to python example
Diffstat:
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/python/examples/solve.py b/python/examples/solve.py
@@ -14,11 +14,13 @@ import nissy
# Choose the solver you prefer
solver = "h48h0k4"
-# Load the pruning table from file
-data = bytearray(open("tables/" + solver, "rb").read())
-
-# If you have not generated the table yet, you can do so:
-# data = nissy.gendata("h48h0k4")
+# Load the pruning table from file, generate it if needed
+datapath = "tables" + os.path.sep + solver
+if os.path.exists(datapath):
+ data = bytearray(open(datapath, "rb").read())
+else:
+ data = nissy.gendata("h48h0k4")
+ print("Generated data will NOT be persisted")
# Get a scrambled cube
cube = nissy.applymoves(nissy.solved_cube, "U F R2");