aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md73
1 files changed, 58 insertions, 15 deletions
diff --git a/README.md b/README.md
index 4f9be77..99c8818 100644
--- a/README.md
+++ b/README.md
@@ -139,22 +139,61 @@ UL1 UB0 BL0 FR1 DF0 UR1 DB0 FL0 DR1 DL1 UF0 BR1 DFR2 DBR0 DFL2 UFR2 UBL2 UFL0 UB
139To solve a cube you can use: 139To solve a cube you can use:
140 140
141``` 141```
142$ ./run solve -solver "h48h0k4" -n 1 -M 4 -cube "JLQWSVUH=ZLCUABGIVTKH" 142$ ./run solve -solver h48h0k4 -n 1 -M 4 -cube "JLQWSVUH=ZLCUABGIVTKH"
143Found 0 solutions, searching at depth 0 143F' U' R
144Found 0 solutions, searching at depth 1 144```
145Found 0 solutions, searching at depth 2 145
146Found 0 solutions, searching at depth 3 146Or alternatively:
147Solution found: F' U R 147
148F' U R 148```
149$ ./run solve_scramble -solver h48h0k4 -n 1 -M 4 -moves "R' U' F"
150F' U' R
149``` 151```
150 152
151For a full list of available command, use `run help`. 153For a full list of available command, use `run help`.
152 154
153## Running commands from a Python shell 155## Using this software as a library
156
157This tool has been developed as a library, so it can be easily included
158in other programs. For this reason, some bindings for languages other
159than C are available.
160
161The API is documented in the public header file `src/nissy.h`.
162
163### C
164
165To use this in a C project, simly include `src/nissy.h`. The tools
166in the `tools/` folder are a good example for how to use this.
167
168NOTE: this project is developed using the C11 standard. If you are using
169an older version of C, you can write your own header file.
170
171### C++
172
173The `cpp` folder contains a C++ header `nissy.h` (C++20 standard) and an
174implementation file `nissy.cpp`. This interface wraps the calls to the
175C functions in an object-oriented C++ interface for more convenient use.
154 176
155There is a work-in-progress python module available. To build it you need 177The `cpp/examples` folder contains some examples for how to use this
156the Python development headers installed. You can check this from the output 178interface. You can build them with e.g.
157of `./configure.sh`: 179
180```
181g++ -std=c++20 cpp/nissy.cpp cpp/examples/solve_h48h3k2.cpp nissy.o
182```
183
184NOTE: If you prefer to use a C-style API, you'll have to write
185your own header, similar to the `extern "C" {}` block at the top of
186`cpp/nissy.cpp`. The C header `src/nissy.h` cannot be compiled as C++,
187as it uses features of C that are not compatible with it.
188
189### Python
190
191The `python` folder contains a Python module. The API provided by
192this module follows the C API quite closely, except its functions
193sometimes return strings instead of writing to `char *` buffers.
194
195To build the Python module you need the Python development headers
196installed. You can check this from the output of `./configure.sh`:
158 197
159``` 198```
160$ ./configure.sh 199$ ./configure.sh
@@ -182,14 +221,18 @@ From here you can call the library functions directly, for example:
182'ASTUGFBH=DACXEZGBLIKF' 221'ASTUGFBH=DACXEZGBLIKF'
183``` 222```
184 223
185Some methods have a different signature in the Pythn module than in 224The `python/examples` folder contains some examples, that you
186libnissy: for example `solve()` returns the solutions as a list of 225can run for example with:
187strings instead of writing them to a return parameter buffer. 226
227```
228$ python python/examples/solve.py
229```
230
188You can access the documentation for the Python module from within 231You can access the documentation for the Python module from within
189a Python interpreter with `help(nissy)`. Cross-check this documentation 232a Python interpreter with `help(nissy)`. Cross-check this documentation
190with the comments in nissy.h for more details. 233with the comments in nissy.h for more details.
191 234
192Please note: the support for the Python module is still rudimentary. 235NOTE: Support for the Python module is still rudimentary.
193 236
194## Cube formats 237## Cube formats
195 238

Generated with cgit - Back to sebastiano.tronto.net