aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-11-08 16:18:14 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2023-11-08 16:18:14 +0100
commite082001f7c7c8ce0d20aebad4e6d6f22d3bf854c (patch)
tree7a8b9875d067feb6c96f39be4080397f8f1eef2d /README.md
parent72c9082c9824c7ffecc97a94083aa350956285e4 (diff)
downloadnissy-core-e082001f7c7c8ce0d20aebad4e6d6f22d3bf854c.tar.gz
nissy-core-e082001f7c7c8ce0d20aebad4e6d6f22d3bf854c.zip
Moved documentation around, improved configure.sh
Diffstat (limited to '')
-rw-r--r--README.md175
1 files changed, 2 insertions, 173 deletions
diff --git a/README.md b/README.md
index aa5c4f7..4a0157a 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,7 @@
1# Prototype for a new optimal solver 1# Prototype for a new optimal solver
2 2
3Work in progress. There is some documentation at the bottom of this page, 3Work in progress. Everything is in a state of flux and can change without
4but do not believe it. Everything is in a state of flux and can change 4notice.
5without notice.
6 5
7## Building and running tests 6## Building and running tests
8 7
@@ -34,173 +33,3 @@ $ make benchmark
34``` 33```
35 34
36for benchmarks. 35for benchmarks.
37
38## TODO:
39
40### Generic solver
41
42* finish implementation
43* tests: solve full cube (max 7-8 moves?)
44* more tests: eo and other stuff
45* benchmarks
46
47### Add NISS
48
49* Add mask to moves (e.g. U | NISS where NISS = 32 or something)
50* Adapt readmoves and writemoves
51
52### Coordinates
53
54* [done] eo
55* co
56* ep
57* epsep
58* cp
59* cpsep
60* cphtr
61
62What about symcoord?
63
64### Solving
65
66All solving functions take a cube and some parameters as input.
67
68* Depth [uint, <= 20]: all solvers work at fixed depth. The caller
69 implementation can implement an A* search.
70* max [int]: the maximum number of solutions to find. Set to a negative
71 value for all solutions.
72* sol [move_t *]: the array for returning the solutions. The caller
73 should make sure that it can hold at least max * depth values.
74* Table [uint8_t *]: table with all the necessare pre-computed info.
75 The table can be generated with a companion function, but reading
76 from and writing to file is delegated to the caller implementation.
77
78Implement the following solvers:
79* Slow: basic solver without any table.
80* H48: one-bit-per-entry table + fallback, 48 symmetries and so on.
81 See planner.
82* nxopt31: mostly for comparison.
83* other nxopt solvers: make generic and take the type as parameter.
84* Step solver: take a coordinate function and a moveset as a parameter.
85
86### cube.h changes
87
88* better documentation: add parameter names, one-line comment
89 for each function
90* prefix public functions with nissy_ or something similar
91* move() that takes a string (alg) as input
92* Add single moves and transformations to the interface? (performance!)
93
94### Documentation and interface
95
96* inline some documentation as comments in source code
97* README.md (maybe convert to txt?) becomes the reference documentation
98
99### Optimizations
100
101* Trans: don't do full compose, for some trans composing perm is enough.
102 Split out sumco() as a separate function and refactor, optimize.
103* Use multi-move (up to 4/5 moves at once)
104* CO is the worst part of moving, transforming and inverting. Try basing
105 everything on representing the cube without CO and apply it only at the
106 end to check that it is actually solved.
107* see if vcube's method to flip all corners is better
108* find a better way for computing the inverse?
109* Improve avx2 instructions in general
110
111## Internal representation of the cube
112
113The plan (TODO) is to have multiple implementations: some that
114take advantage of advanced CPU instructions (SIMD) and a fallback
115"array" representation that works on any architecture.
116
117### Array representation (fallback)
118
119In this implementation of the cube.h interface, the cube is represented
120by two arrays of 8-bit unsigned integers, one for centers and one for
121corners. The 4 leas-significant digits of each bit determine the piece,
122the other 4 are used for orientation or kept to 0.
123
124Edges:
125 xxxopppp (x = unused, o = orientation, p = piece)
126
127Corners:
128 xooxpppp (x = unused, o = orientation, p = piece)
129
130The two bits for CO are shifted to make it possible to perform mod 3
131operations (sum, inverse) using only addition and bitwise operators.
132See below for details.
133
134The third bit is needed because x+y+1 can exceed 4.
135
136### AVX2
137
138Work in progress
139
140
141## Textual representation of the cube
142
143The functions readcube() and writecube() use different formats to read
144and write a cube to text. Not all formats are supported for both input
145and output.
146
147### H48 - standard format for h48 (read, write)
148
149Each edge is represented by two letters denoting the sides it belongs to
150and one number denoting its orientation (0 oriented, 1 mis-oriented).
151Similarly, each corner is represented by three letters and a number
152(0 oriented, 1 twisted clockwise, 2 twisted counter-clockwise).
153Edge orientation is relative to the F / B axis, corner orientation is
154relative to the U / D axis.
155
156The pieces are ordered such that the solved cube looks like this:
157
158UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0
159UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
160
161Whitespace (including newlines) between pieces is ignored when reading
162the cube, and a single whitespace character is added between pieces
163when writing.
164
165The cube after the moves R'U'F looks like this:
166
167FL1 BR0 DB0 UR1 UF0 UB0 DL0 FR0 UL1 DF1 BL0 DR0
168UBL1 DBR1 UFR2 DFR2 DFL2 UBL2 UFL2 DBL0
169
170### SRC - representation of the object in C code for cube_array (write)
171
172The exact format depends on the internal cube representation (TODO: actually
173this is false, because I need all formats for code generation; also adapating
174tests is hard). It is guaranteed that, if OUT is the output in this format,
175the line
176
177cube_t cube = OUT;
178
179is interpreted correctly by h48.
180
181
182## Transformations
183
184Transformations can be either simple rotations or a rotation composed
185with a mirroring.
186
187Simple rotations are denoted by two letters corresponding to the faces
188to be moved to the U and F positions, respectively. For example FD is
189the rotation that brings the F face on top and the D face on front.
190
191A composed rotation + mirror is obtained by applying the corresponding
192rotation to the solved cube mirrored along the M plane.
193
194For example, to apply the transformation RBm (mirrored RB) to a cube C:
195 1a. Apply a mirror along the M plane to the solved cube
196 1b. Rotate the mirrored cube with z' y2
197 3. Apply the cube C to the transformed solved cube
198 4. Apply the transformations of step 1a and 1b in reverse
199
200The orientation of pieces after a rotation ignores the new position
201of centers. A rotated cube can technically be inconsistent, because
202the parity of the edge permutation has to be adjusted considering the
203parity of the centers, which we ignore.
204
205The utility script mirror.sh transforms a solved, rotated cube to its
206mirrored and rotated version.

Generated with cgit - Back to sebastiano.tronto.net