aboutsummaryrefslogtreecommitdiff
path: root/python/examples
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-08-11 12:05:08 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2025-08-11 12:05:08 +0200
commit4544e08997a7af6a8defa47efae1e9ba5c2c30f6 (patch)
treeaa211e7f80429ca758573349e1866861469ec12b /python/examples
parentd25f23805c6d7128b508a359d47af136dd2fd0db (diff)
downloadnissy-core-4544e08997a7af6a8defa47efae1e9ba5c2c30f6.tar.gz
nissy-core-4544e08997a7af6a8defa47efae1e9ba5c2c30f6.zip
Simplified name of Python module
Diffstat (limited to 'python/examples')
-rw-r--r--python/examples/move.py7
-rw-r--r--python/examples/solve.py11
-rw-r--r--python/examples/variations.py5
3 files changed, 14 insertions, 9 deletions
diff --git a/python/examples/move.py b/python/examples/move.py
index 9c7a756..0ed879b 100644
--- a/python/examples/move.py
+++ b/python/examples/move.py
@@ -1,10 +1,13 @@
1# Small example of nissy_python_module usage 1# Small example of nissy Python module usage
2# See the solve.py example for more details on how this works 2# See the solve.py example for more details on how this works
3 3
4import os, sys 4import os, sys
5 5
6# Assume we are eithe rin the top-level directory of the nissy-core repo,
7# or in the python subdirectory
6sys.path.append(os.getcwd()) 8sys.path.append(os.getcwd())
7import nissy_python_module as nissy 9sys.path.append(os.getcwd() + os.path.sep + "python")
10import nissy
8 11
9cube = nissy.applymoves(nissy.solved_cube, "R' U' F"); 12cube = nissy.applymoves(nissy.solved_cube, "R' U' F");
10print("Cube after the moves R' U' F:") 13print("Cube after the moves R' U' F:")
diff --git a/python/examples/solve.py b/python/examples/solve.py
index e3752fe..d77dd74 100644
--- a/python/examples/solve.py
+++ b/python/examples/solve.py
@@ -1,14 +1,15 @@
1# Small example of nissy_python_module usage 1# Small example of nissy Python module usage
2 2
3# Compile the python module with "make python", then run this from the main 3# Run "./build python", then run this from either the top-level directory
4# folder containing nissy_python_module.so 4# of the nissy-core repo or from the python subdirectory.
5 5
6# Append the main folder to the python path so we can load the module 6# Append the directories to the python path so we can load the module
7import sys, os 7import sys, os
8sys.path.append(os.getcwd()) 8sys.path.append(os.getcwd())
9sys.path.append(os.getcwd() + os.path.sep + "python")
9 10
10# Import with a nicer name 11# Import with a nicer name
11import nissy_python_module as nissy 12import nissy
12 13
13# Choose the solver you prefer 14# Choose the solver you prefer
14solver = "h48h0k4" 15solver = "h48h0k4"
diff --git a/python/examples/variations.py b/python/examples/variations.py
index 1a9d5bb..2507e6e 100644
--- a/python/examples/variations.py
+++ b/python/examples/variations.py
@@ -1,9 +1,10 @@
1# Small example of nissy_python_module usage 1# Small example of nissy Python module usage
2# See the solve.py example for more details on how this works 2# See the solve.py example for more details on how this works
3 3
4import sys, os 4import sys, os
5sys.path.append(os.getcwd()) 5sys.path.append(os.getcwd())
6import nissy_python_module as nissy 6sys.path.append(os.getcwd() + os.path.sep + "python")
7import nissy
7 8
8moves = "R U' Bw2 M D' x' F B(E2 F D B' Lw2 U2 U' S2 B)" 9moves = "R U' Bw2 M D' x' F B(E2 F D B' Lw2 U2 U' S2 B)"
9 10

Generated with cgit - Back to sebastiano.tronto.net