-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.md
133 lines (97 loc) · 6.3 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Cubically's Documentation
- [Home](index.html)
- [Code page](https://cubically.github.io/docs/codepage)
- [Commands](commands.html)
- [Memory](memory.html)
- [Functions](functions.html)
- [Inner layers](layers.html)
- [Syntax](syntax.html)
# Quick guide
This quick guide will get you started with enough to write some code, but not enough to delve into the pain and terror of the language.
### What is "Cubically"?
Cubically is an [esoteric programming language], meaning that it is intentionally difficult to program in.
Other esoteric languages may use a [stack] or a [tape] to store data. Cubically, however, uses a built-in Rubik's Cube and three more [memory locations](memory.html) with varying levels of read-write restrictions.
Cubically specializes in Rubik's Cubes, so almost all of its [commands](commands.html) and functionalities are based around the memory cube. Some, such as XOR and LSHIFT, are really completely useless, but we decided they should be in the language. `` ¯\_(ツ)_/¯ ``
### Syntax
Digits are arguments and non-digits are commands. A command can only be one letter long. (That rule, which you still need to know, is broken so many times it's not even funny.)
code: RL2UD23
does: R call command R without arguments
L2 call command L with argument 2
U call command U without arguments
D23 call command D with argument 2, then argument 3 (NOT argument 23)
### Cube commands
Any algorithm, or sequence of moves, in [Singmaster's notation], is valid Cubically code.
|Command|Description|
|-|-|
|`R`|rotate the right layer of the cube 90° clockwise|
|`L`|rotate the left layer of the cube 90° clockwise|
|`U`|rotate the top layer of the cube 90° clockwise|
|`D`|rotate the bottom layer of the cube 90° clockwise|
|`F`|rotate the front layer of the cube 90° clockwise|
|`B`|rotate the back layer of the cube 90° clockwise|
Call any of the above commands with the argument `2` for a 180° turn, and the argument `'` or `3` for a counterclockwise turn.
### Multiple sizes
Since [v2.0][cubically-git-v2.0], Cubically has supported more than just a 3x3x3 for the memory cube. In the interpreter's command-line invocation, append an argument to specify the size: `4` for a 4x4x4 memory cube, or a `5` for a 5x5x5, etc.
**But Singmaster's notation only defines moves for a 3x3x3 D: how can I turn the inner layers of a larger cube?**
Unicode subscripts (`₀₁₂₃₄₅₆₇₈₉`), while breaking the "a command can only be one character long" rule, give you the ability to [turn the inner layers](layers.html). For example, `R` (performed on a solved 4x4x4) changes the cube's state to this:
```
0002
0002
0002
0002
1111222533330444
1111222533330444
1111222533330444
1111222533330444
5554
5554
5554
5554
```
However, performing `R₁` on a solved 4x4x4 changes the cube's state to this:
```
0020
0020
0020
0020
1111225233334044
1111225233334044
1111225233334044
1111225233334044
5545
5545
5545
5545
```
`R` means "turn the right face 90° clockwise." So `R₁` means "turn the layer 1 inwards from the right face 90° clockwise."
These can be pretty fun. Try [running][TIO-1] `RR₁'R₂R₃'R₄ UU₁'U₂U₃'U₄ L'L₁L₂'L₃L₄'` on a 5x5x5.
### But how do I interact with the cube?
When I first made Cubically, with the memory cube alone and no other way to store data, it was nothing but a console emulator for a Rubik's Cube. However, I decided I wanted to turn it into an esoteric programming language, so I added one more piece of memory, the notepad. The value "written" on the notepad could be modified based on the different states of the cube. So I introduced the concept of [memory locations](memory.html). Memory location `0` would always store the sum of the top face of the cube (the face that's filled with `0`s when the cube is unsolved). Memory location `1` would always store the sum of the left face, `2` stored the right face sum, etc.
Try scrambling up the cube and running `:1 %6` - `:1` to set the notepad to the sum of the left face, and `%6` to print the notepad (memory location `6`). What did it print? Try a different scramble with the same `:1 %6` at the end. See what different values you can get!
For ease of use, Cubically automatically dumps the memory cube and the notepad at the end of the program. For example, after running the code `R2L2U2D2F2B2`, Cubically prints this:
```
Notepad: 0
050
505
050
131242313424
313424131242
131242313424
505
050
505
```
### Cubically sounds fun, but how can I actually use it?
You can download the interpreter in the [GitHub repo][cubically-git]. You need [GCC] and [Make] installed.
You can also use the [online interpreter](https://tio.run/##Sy5NykxOzMmp/P8/KOhRU6M6kGgC4mYQo0UhNBQkBiSaQkFioSAxH3UfoCAQN4EYzUDcov7//39TAA), thanks to [Dennis](https://codegolf.stackexchange.com/users/12012/dennis) of [Programming Puzzles and Code Golf](//codegolf.stackexchange.com), where you can find many [fun Cubically programs](https://codegolf.stackexchange.com/search?q=cubically+is%3Aanswer) in friendly competition.
### Who's responsible for this mess?
Most of Cubically, such as the interpreter and the documentation, was written by me, a.k.a. MD XF on the internet ([PPCG](https://codegolf.stackexchange.com/users/61563/md-xf), [GitHub](https://github.com/aaronryank)). Thanks to the members of the [Cubically team](//github.com/Cubically) - Kamil Drakari ([PPCG](https://codegolf.stackexchange.com/users/71434/kamil-drakari), [GitHub](https://github.com/drakari)) and TehPers ([PPCG](https://codegolf.stackexchange.com/users/72489/tehpers), [GitHub](https://github.com/TehPers)) for valuable contributions.
[GCC]: https://www.gnu.org/software/gcc/
[Make]: https://www.gnu.org/software/make/
[cubically-git]: https://git.io/Cubically
[cubically-git-v2.0]: https://github.com/aaronryank/Cubically/releases/tag/v2.0
[Singmaster's notation]: https://proofwiki.org/wiki/Definition:Singmaster_Notation
[stack]: https://en.wikipedia.org/wiki/Stack_(abstract_data_type)
[tape]: https://esolangs.org/wiki/Tape
[esoteric programming language]: https://en.wikipedia.org/wiki/Esoteric_programming_language
[TIO-1]: https://tio.run/##Sy5NykxOzMmp/P8/KOhRU6M6kGgC4mYQo0UhNBQkBiSaQkFioSAxH3UfoCAQN4EYzUDcov7//39TAA