aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2023-10-31 19:17:42 +0100
committerSebastiano Tronto <sebastiano@tronto.net>2023-10-31 19:17:42 +0100
commitd65ce8e86b517ef3f7d48cf5ded1101444e05b2b (patch)
tree6ac473a067fa06dbd64691adf2ddaafd8adc6e06 /README.md
parentbc2e6b8a8d5a6eccd2c2ac433e8a307ee356f14e (diff)
downloadnissy-core-d65ce8e86b517ef3f7d48cf5ded1101444e05b2b.tar.gz
nissy-core-d65ce8e86b517ef3f7d48cf5ded1101444e05b2b.zip
Reorganized documentation
Diffstat (limited to 'README.md')
-rw-r--r--README.md107
1 files changed, 103 insertions, 4 deletions
diff --git a/README.md b/README.md
index fb941c8..59a6bcc 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,8 @@
1# Prototype for a new optimal solver 1# Prototype for a new optimal solver
2 2
3Work in progress. 3Work in progress. There is some documentation at the bottom of this page,
4but do not believe it. Everything is in a state of flux and can change
5without notice.
4 6
5## Running tests 7## Running tests
6 8
@@ -38,9 +40,8 @@ $ make test
38 40
39### Documentation and interface 41### Documentation and interface
40 42
41* remove the constant #define's from cube.h (write a comment instead) 43* inline some documentation as comments in cube.h or cube.c
42* reconsider content of cube.h, remove some stuff 44* README.md (maybe convert to txt?) becomes the reference documentation
43* remove doc folder, inline documentation as comments in cube.h or cube.c
44 45
45### AVX2 46### AVX2
46 47
@@ -64,3 +65,101 @@ $ make test
64 [_mm256_shuffle_epi8](https://www.intel.com/content/www/us/en/docs/cpp-compiler/developer-guide-reference/2021-10/mm256-shuffle-epi8.html)) 65 [_mm256_shuffle_epi8](https://www.intel.com/content/www/us/en/docs/cpp-compiler/developer-guide-reference/2021-10/mm256-shuffle-epi8.html))
65* Inspect compiled assembly 66* Inspect compiled assembly
66* Use valgrind tool cachegrind and other profiling tools 67* Use valgrind tool cachegrind and other profiling tools
68
69
70## Internal representation of the cube
71
72The plan (TODO) is to have multiple implementations: some that
73take advantage of advanced CPU instructions (SIMD) and a fallback
74"array" representation that works on any architecture.
75
76### Array representation (fallback)
77
78In this implementation of the cube.h interface, the cube is represented
79by two arrays of 8-bit unsigned integers, one for centers and one for
80corners. The 4 leas-significant digits of each bit determine the piece,
81the other 4 are used for orientation or kept to 0.
82
83Edges:
84 xxxopppp (x = unused, o = orientation, p = piece)
85
86Corners:
87 xooxpppp (x = unused, o = orientation, p = piece)
88
89The two bits for CO are shifted to make it possible to perform mod 3
90operations (sum, inverse) using only addition and bitwise operators.
91See below for details.
92
93The third bit is needed because x+y+1 can exceed 4.
94
95### AVX2
96
97Work in progress
98
99
100## Textual representation of the cube
101
102The functions readcube() and writecube() use different formats to read
103and write a cube to text. Not all formats are supported for both input
104and output.
105
106### H48 - standard format for h48 (read, write)
107
108Each edge is represented by two letters denoting the sides it belongs to
109and one number denoting its orientation (0 oriented, 1 mis-oriented).
110Similarly, each corner is represented by three letters and a number
111(0 oriented, 1 twisted clockwise, 2 twisted counter-clockwise).
112Edge orientation is relative to the F / B axis, corner orientation is
113relative to the U / D axis.
114
115The pieces are ordered such that the solved cube looks like this:
116
117UF0 UB0 DB0 DF0 UR0 UL0 DL0 DR0 FR0 FL0 BL0 BR0
118UFR0 UBL0 DFL0 DBR0 UFL0 UBR0 DFR0 DBL0
119
120Whitespace (including newlines) between pieces is ignored when reading
121the cube, and a single whitespace character is added between pieces
122when writing.
123
124The cube after the moves R'U'F looks like this:
125
126FL1 BR0 DB0 UR1 UF0 UB0 DL0 FR0 UL1 DF1 BL0 DR0
127UBL1 DBR1 UFR2 DFR2 DFL2 UBL2 UFL2 DBL0
128
129### SRC - representation of the object in C code for cube_array (write)
130
131The exact format depends on the internal cube representation (TODO: actually
132this is false, because I need all formats for code generation; also adapating
133tests is hard). It is guaranteed that, if OUT is the output in this format,
134the line
135
136cube_t cube = OUT;
137
138is interpreted correctly by h48.
139
140
141## Transformations
142
143Transformations can be either simple rotations or a rotation composed
144with a mirroring.
145
146Simple rotations are denoted by two letters corresponding to the faces
147to be moved to the U and F positions, respectively. For example FD is
148the rotation that brings the F face on top and the D face on front.
149
150A composed rotation + mirror is obtained by applying the corresponding
151rotation to the solved cube mirrored along the M plane.
152
153For example, to apply the transformation RBm (mirrored RB) to a cube C:
154 1a. Apply a mirror along the M plane to the solved cube
155 1b. Rotate the mirrored cube with z' y2
156 3. Apply the cube C to the transformed solved cube
157 4. Apply the transformations of step 1a and 1b in reverse
158
159The orientation of pieces after a rotation ignores the new position
160of centers. A rotated cube can technically be inconsistent, because
161the parity of the edge permutation has to be adjusted considering the
162parity of the centers, which we ignore.
163
164The utility script mirror.sh transforms a solved, rotated cube to its
165mirrored and rotated version.

Generated with cgit - Back to sebastiano.tronto.net