aboutsummaryrefslogtreecommitdiff
path: root/python/example.py
blob: fdea2d4c66a3a4f8222885c60f82204e91677686 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Small example of nissy_python_module usage

# Compile the python module with "make python", then run this from the main
# folder containing nissy_python_module.so

# Append the main folder to the python path so we can load the module
from sys import path
path.append("./")

# Import with a nicer name
import nissy_python_module as 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")

# Get a scrambled cube
cube = nissy.applymoves(nissy.solved_cube, "U F R2");

# Solve!
solutions = nissy.solve(cube, solver, nissy.nissflag_normal, 0, 9, 3, -1, data)

# Print the solutions, one per line
print("Found ", len(solutions), " solutions:")
for s in solutions:
	print(s)

# You can use help(nissy) for more info about the available methods:
# help(nissy)

# Or help(nissy.methodname) if you want to know more about a specific method:
# help(nissy.solve)

Generated with cgit - Back to sebastiano.tronto.net