|
| 1 | +#import "@preview/burik:0.1.0": * |
| 2 | + |
| 3 | += Burik — A Typst Library for easy Rubik's Cube tutorials edition |
| 4 | +#v(1em) |
| 5 | +*Burik* is a Typst library specifically designed to facilitate the creation of tutorials for *3x3 Rubik's Cube* solving. |
| 6 | + |
| 7 | +Burik was first designed to make life easier for tutorial creators, as it allows algorithms manipulation in strings and algorithms visualization with parametrizable drawing functions from different point of view. |
| 8 | + |
| 9 | +There is also an interest for the tutorial's user as there is no possible mismatch between the written algorithm and the displayed image. |
| 10 | + |
| 11 | +== Installation |
| 12 | + |
| 13 | +To use this package, clone this #link("https://github.com/Gcalmet/burik", "GitHub repository") or add this line at the beginning of your document in the webapp : |
| 14 | + |
| 15 | +````typ |
| 16 | +#import "@preview/burik:0.1.0" |
| 17 | +```` |
| 18 | + |
| 19 | +== Use example |
| 20 | + |
| 21 | +````typ |
| 22 | +#import "@preview/burik:0.1.0" |
| 23 | +#f2l("f R' f'") |
| 24 | +#oll("r U R' U R U2 r'") |
| 25 | +#pll("R' U R' U' R3 U' R' U R U R2") |
| 26 | +```` |
| 27 | + |
| 28 | +#f2l("f R' f'") |
| 29 | +#oll("r U R' U R U2 r'") |
| 30 | +#pll("R' U R' U' R3 U' R' U R U R2") |
| 31 | + |
| 32 | +You can check the #link("example.typ", "example file") for more usage examples. |
| 33 | + |
| 34 | +== How does it work ? |
| 35 | + |
| 36 | +When you pass an algorithm to Burik, it inverts it and executes the inverted algorithm on a solved cube. As a result, it obtains a configuration in which executing the non-inverted algorithm is useful. |
| 37 | + |
| 38 | +== Moves |
| 39 | + |
| 40 | +Moves used to encode an algorithm on the Rubik's Cube are the standard ones (visit #link("https://jperm.net/3x3/moves", "J Perm website") for more details). |
| 41 | + |
| 42 | + |
| 43 | +// link to the website |
| 44 | + |
| 45 | +- #raw("F, B, R, L, U, D") for the 6 classical moves |
| 46 | +- #raw("f, b, r, l, u, d ") for the 6 wide moves |
| 47 | +- #raw("E, S, M ") for the 3 slice moves |
| 48 | +- #raw("x, y, z") for the 3 cube rotations |
| 49 | + |
| 50 | +In each case, you can use #raw(" ', 2, 3, ") to indicate the number of turns. |
| 51 | + |
| 52 | +== Algorithms |
| 53 | + |
| 54 | +For Burik, an algorithm is a string of moves separated by a space. For instance `"R U R' U R U2 R' U"` can be interpreted as an algorithm. |
| 55 | + |
| 56 | +Algorithms come with tool functions that can be used to create new algorithms or for easier manipulation : |
| 57 | + |
| 58 | +- `conc(A, B)` returns `C` such that `C = A + B` |
| 59 | + |
| 60 | +- `invert(A)` returns `A'` such that `A + A' = " "` |
| 61 | + |
| 62 | +- `enclose(A, B)` returns `C` such that `C = B + A + B'` |
| 63 | + |
| 64 | +- `simplify(A)` returns `A'` such that `A = A'` and that `A'`̀ has no useless moves |
| 65 | + |
| 66 | +== Colors |
| 67 | + |
| 68 | +There are seven parametrizable colors in RGB hexadecimal code in `cubes.typ` |
| 69 | + |
| 70 | +- #text(color.white, "white") for stickers from the `U` face |
| 71 | +- #text(color.yellow, "yellow") for stickers from the `D` face |
| 72 | +- #text(color.red, "red") for stickers from the `R` face |
| 73 | +- #text(color.orange, "orange") for stickers from the `L` face |
| 74 | +- #text(color.green, "green") for stickers from the `F` face |
| 75 | +- #text(color.blue, "blue") for stickers from the `B` face |
| 76 | +- #text(color.black, "black") for every non-colorized stickers |
| 77 | + |
| 78 | +== Cubes |
| 79 | + |
| 80 | +Cubes are dictionnaries with 6 keys ` u, d, f, b, r, l ` for the six faces, and each value is an array of 9 colors. |
| 81 | + |
| 82 | +There are 3 predefined cubes in `cubes.typ` and they all have white on top and green in front : |
| 83 | + |
| 84 | +- `pll-cube` is a fully solved cube |
| 85 | + |
| 86 | +- `oll-cube` has solved white face, two first layers and yellow face (black stickers on the last layer permutation) |
| 87 | + |
| 88 | +- `f2l-cube` has solved white face and two first layers. The last layer and the yellow face is in black. |
| 89 | + |
| 90 | +There is no assertion that the cubes that you may create from scrath using the same method are solvable, so you must be careful when doing so. I would recommend using the predefined cubes as much as possible. |
| 91 | + |
| 92 | +== Drawing |
| 93 | + |
| 94 | +There are 3 drawing functions : |
| 95 | + |
| 96 | +- `draw-pattern` for drawing the 6 faces of the cube as the pattern of a cube (useful for debugging or scramble checking) |
| 97 | + |
| 98 | +- `draw-last-layer` for drawing the last layer with reduced stickers for the side pieces (useful for OLL, PLL and every last layer algorithm) |
| 99 | + |
| 100 | +- `draw-3d-cube` for drawing the cube in perpective with a view on faces `F, U, R` (useful for F2L) |
| 101 | + |
| 102 | +And there also 3 illustrating functions : |
| 103 | + |
| 104 | +- `pll` to illustrate PLL algorithms, by default this is in the last face point of view, with yellow face on top, green in front, and starting with the `pll-cube` as the target configuration. You can choose to display black arrows on the yellow face to illustrate ongoing permutations. |
| 105 | + |
| 106 | +- `oll` to illustrate OLL algorithms, by default this is in the last face point of view, with yellow face on top, green in front, and starting with the `oll-cube` as the target configuration. |
| 107 | + |
| 108 | +- `f2l` to illustrate F2L algorithms, by default this is in the 3D view, with yellow face on top, green in front, and starting with the `f2l-cube` as the target configuration. |
| 109 | + |
| 110 | +== License |
| 111 | + |
| 112 | +This project is licensed under the MIT License. You can find the full text in the `LICENSE` file included in this repository. |
| 113 | + |
| 114 | +== Future Work |
| 115 | + |
| 116 | +There are no current versions that include other cube shapes than 3x3 (like 2x2, 4x4, 5x5, ...) or other puzzle shapes (like megaminx, skewb, ...). |
0 commit comments