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