aboutsummaryrefslogtreecommitdiff
path: root/python/example.py
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-04-14 14:00:44 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2025-04-14 14:00:44 +0200
commit3ab1012ea8c55f82812b5998fd6b4fdf53dea70e (patch)
treed18552619a364fcb816d5e2d2331822edd7e2045 /python/example.py
parent7b8c1e4634784b57bb6223cd780d5c67f5381d43 (diff)
downloadnissy-core-3ab1012ea8c55f82812b5998fd6b4fdf53dea70e.tar.gz
nissy-core-3ab1012ea8c55f82812b5998fd6b4fdf53dea70e.zip
Improved C++ API and added info to README
Diffstat (limited to 'python/example.py')
-rw-r--r--python/example.py37
1 files changed, 0 insertions, 37 deletions
diff --git a/python/example.py b/python/example.py
deleted file mode 100644
index b939183..0000000
--- a/python/example.py
+++ /dev/null
@@ -1,37 +0,0 @@
1# Small example of nissy_python_module usage
2
3# Compile the python module with "make python", then run this from the main
4# folder containing nissy_python_module.so
5
6# Append the main folder to the python path so we can load the module
7from sys import path
8path.append("./")
9
10# Import with a nicer name
11import nissy_python_module as nissy
12
13# Choose the solver you prefer
14solver = "h48h0k4"
15
16# Load the pruning table from file
17data = bytearray(open("tables/" + solver, "rb").read())
18
19# If you have not generated the table yet, you can do so:
20# data = nissy.gendata("h48h0k4")
21
22# Get a scrambled cube
23cube = nissy.applymoves(nissy.solved_cube, "U F R2");
24
25# Solve!
26solutions = nissy.solve(cube, solver, nissy.nissflag_normal, 0, 9, 3, -1, 4, data)
27
28# Print the solutions, one per line
29print("Found ", len(solutions), " solutions:")
30for s in solutions:
31 print(s)
32
33# You can use help(nissy) for more info about the available methods:
34# help(nissy)
35
36# Or help(nissy.methodname) if you want to know more about a specific method:
37# help(nissy.solve)

Generated with cgit - Back to sebastiano.tronto.net