aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'README.md')
-rw-r--r--README.md149
1 files changed, 118 insertions, 31 deletions
diff --git a/README.md b/README.md
index 39d1857..fc71f2d 100644
--- a/README.md
+++ b/README.md
@@ -1,41 +1,128 @@
1# nissy 1# Nissy
2A Rubik's cube solver and FMC assistant.
3 2
4## Just another cube solver? 3A Rubik's cube solver and FMC assistant. For optimal HTM solving nissy is about as
5Yes, pretty much. I wanted to write one and I started coding without any 4fast as Herbert Kociemba's [Cube Explorer](http://kociemba.org/cube.htm), and it
6specific goal in mind. It is not more efficient than [CubeExplorer](http://kociemba.org/cube.htm), nor it is 5uses the same method. Nissy can also solve many different substeps of
7particularly user-friendly. 6Thistlethwaite's algorithm (DR/HTR), and can use NISS (Normal-Inverse Scramble Switch).
8 7
9## But does it do something unique? 8It can be useful to analyze your DR solves (and more, once I implement more features).
10Yes, actually it does, but only for a very small niche of people. It allows to produce step-by-step solutions using DR
11([Thistlethwaite](/https://www.speedsolving.com/wiki/index.php/Thistlethwaite%27s_algorithm)/[Kociemba](https://www.speedsolving.com/wiki/index.php/Kociemba%27s_Algorithm) algorithm)
12combined with [NISS](https://www.speedsolving.com/wiki/index.php/Fewest_Moves_techniques). This makes it somewhat useful for [FMC](https://www.speedsolving.com/wiki/index.php/Fewest_Moves_Challenge) solvers who want to analyze a scramble and see if they missed something,
13or what was the optimal way to solve a certain substep at a given point, and so on.
14 9
15## How to use it 10## Why should I use nissy?
16**Update:** the file nissy-win.exe should work as a Windows executable, but
17I have not tested it (I don't have a Windows machine).
18 11
19Check out the help pages in the docs folder. They are also available from 12You should use nissy if you:
20within nissy with the command "help". 13* Want to analyze your DR solutions or check for multiple optimal (or sub-optimal)
14solutions for EO/DR/HTR or similar substeps.
15* You just want a Rubik's cube solver and you like command line interfaces.
16* You want an alternative to Cube Explorer.
21 17
22I will add more examples and maybe screenshots when I feel like. 18## Requirements
19
20A full installation of nissy requires about 1.8Gb of space, of which 1.6Gb are
21occupied by the huge pruning table for optimal solving, and running it requires
22the same amount of RAM.
23One can choose to never use the optimal solver and not to install the relative
24pruning table. If so, about 200Mb should be enough.
23 25
24## Installation 26## Installation
25For now you have to download all the files and compile the source
26code yourself. Remember to tell your
27compiler to use the [C99 standard](https://en.wikipedia.org/wiki/C99). For
28example, on a Linux system with GCC installed:
29 27
30``` 28### On a UNIX system:
31cd path/to/nissy 29
32gcc -O2 -std=c99 -o nissy ./src/*.c 30You can download the source code for the latest version from git or simply clone
33./nissy 31the repo with `git clone https://github.com/sebastianotronto/nissy`.
34``` 32
33Edit the Makefile to match your local configuration (usually not necessary, but you
34may want to change the `PREFIX` variable) and run `make`, followed by `make install`.
35After that, you need to download some files and manually save them to your `NISSYDATA`
36folder (see manual page, ENVIRONMENT section). If you don't do it nissy can compute
37these files when needed and save them in the correct folders, but some of them
38take hours to generate even for a powerful computer (for reference, the huge pruning
39table takes about 20 hours on my laptop).
40
41Choose one of the following:
42
43| |.zip|.tar.gz|
44|-|-|-|
45|Full (~720Mb)|[full.zip](https://math.uni.lu/tronto/nissy/nissy-tables-full.zip)|[full.tar.gz](https://math.uni.lu/tronto/nissy/nissy-tables-full.tar.gz)|
46|No huge table (~90Mb)|[nohuge.zip](https://math.uni.lu/tronto/nissy/nissy-tables-nohuge.zip)|[nohuge.tar.gz](https://math.uni.lu/tronto/nissy/nissy-tables-nohuge.tar.gz)|
47
48extract the archive and copy the `tables` folder into `NISSIDATA` (paste there
49the whole folder, not the single files). The `nohuge` files are much smaller and
50do not contain the huge pruning table for the optimal solver.
51
52### On Windows
53
54Coming soon.
55
56## Structure of the code
57
58You can find all the source code in the `src` folder.
59I strived to keep it legible but I did not write many comments (barely any at all).
60I'll try to explain here the main parts of the program.
61
62### Cube, moves and transformations
63
64There are many ways to represent a cube. In nissy I use two:
65* An array representation `CubeArray`: 3 arrays representing the permutation
66of corners, edges and centers and 2 arrays for the orientation of corners and edges.
67* An 11-integers representation `Cube`: 3 integers for edge orientation (with respect
68to the three axes), 3 for corner orientation, and so on. Edge permutation is a bit
69complicated because encoding 12 factorial as a single number is too large for some
70practical reasons, so I use 3 integers for that.
71
72Moves are easy to apply on the array form, but they are slow. So `moves.c`
73contains the instructions to create all the transition tables necessary
74to get the next position for the cube with just 11 lookup operations
75(one for each of the 11 integers in the second representation).
76These transition tables are saved in the `mtables` file in the
77`tables` folder in binary format.
78
79The 11 integers are obviously redundant, but keeping all of them makes it easy
80to apply transformations. A transformation is a rotation of the whole cube, possibly
81combined with a mirror operation. Applying a transformation to a cube (say obtained
82by applying a scramble to the solved cube) means applying the transformation to a
83solved cube, then the scramble and then the inverse of the transformation
84(i.e. conjugating by it).
85
86### Coordinates and pruning tables
87
88A *coordinate* consists of a function that takes a cube (in the 11-integer
89representation) and return an (unsigned, 64-bit) integer. They are used
90to "linearize" a cube and build pruning tables, which speed up significantly the
91solving process. To be able to access the pruning table quickly, the function
92needs to be very fast (e.g. it should not convert between the two representations
93of the cube if not necessary).
94
95Some coordinates make use of symmetries to reduce the size of the resulting
96pruning table. Unfortunately this complicates the code a lot, but it is a huge
97advantage: it reduces by a factor of about 16 the huge pruning table, which
98results in around 1.6Gb instead of 24 or so.
99
100Pruning tables are related to a specific step, a moveset and a coordinate. They
101contain one value from 0 to 15 (4 bits) for each possible value for the coordinate,
102which is less or equal than the minimum number of moves required to solve the
103given step with the given moveset for a cube which has the given coordinate. For example,
104say the coordinate `neo` gives the number of non-oriented edges (say with respect to
105F/B). Then the possible values for the coordinate are 0,2,4,...,12. An associate pruning
106table to solving EO with HTM moveset and this coordinate would have values 0 (for
107`neo=0`), 3 (for `neo=2`), 1 (for `neo=4`)...
108
109There is one caveat: each coordinates also needs an inverse function that takes a
110coordinate value and returns a cube which has that coordinate. This is in general
111more complicated, but luckily the cube does not need to be fully built or consistent.
112This inverse-coordinate is used only in one specific step when building pruning tables
113to avoid using up hundreds of Gb of memory.
114
115Note: this part is different from what Cube Explorer does. Overall I think it is
116conceptually easier, although in practice it was still hard to implement.
117If anything it is more generalizable and one can use it to build any coordinate
118they might like.
119
120### Solving
35 121
36You can also use the script compile.sh, which executes that 122Solving is implemented as a generic function that takes both a step and
37gcc line (with a few extra options). 123a (scrambled) cube as input, as well as some extra parameters that say e.g.
124how many solution one wants. A step consists, among other things, of
125an estimator function that, given a cube, gives a lower bound for the number
126of moves needed to complete the step. Many of these estimators simply
127look up the corresponding values in the appropriate pruning table.
38 128
39## Tips
40You can use a tool such as [rlwrap](https://github.com/hanslub42/rlwrap) to allow
41for infinte command history within nissy!

Generated with cgit - Back to sebastiano.tronto.net