A 3x3x3 cube solver
# Install `cube` command
$ cargo install --path .
# Input Samples
$ cat sample.input
$ cat sample2.input
# Solving only with U, D and F operations
$ cube -UDF < sample.input
[2022-09-06T06:24:39Z INFO ] Solution: DDU'
{"ok":true,"solutions":[{"algorithm":"DDU'","length":3}]}
# Solving with CFOP Method
$ cube --cfop < sample2.input
# Solving with Roux Method
$ cube --roux < sample2.input
Solve left (initial state) into right (goal state).
Init {
YYY
YYY
YYY
GGG OOO BBB RRR
RRR GGG OOO BBB
OOO BBB RRR GGG
WWW
WWW
WWW
}
Goal {
YYY
YYY
YYY
RRR GGG OOO BBB
RRR GGG OOO BBB
RRR GGG OOO BBB
WWW
WWW
WWW
}
Or you can give scramble.
Scramble {
U D2
}
Goal { ... }
can be omitted.
The default is standard form, up-face is yellow and front-face is red.
Standard form.
W
: WhiteY
: YellowB
: BlueG
: GreenR
: RedO
: Orange.
: Other Color (.
matches to.
)*
: Wildcard (Any colors matching)
U D F B L R
, clockwiseU' D' F' B' L' R'
, counter-clockwiseU2 D2 F2 B2 L2 R2
, 180 rotateu d f b l r
, double-layers rotationu' d' f' b' l' r'
u2 d2 f2 b2 l2 r2
Uw Dw Fw Bw Lw Rw
, also ok
M S E
M' S' E'
x y z
, (r) (u) (f)
<Input> ::= <Entry> | <Entry> <Input>
<Entry> ::= Init { <Cube> }
| Goal { <Cube> }
| Scramble { <Operations> }
<Cube> ::= <Color> * 54
<Operations> ::= <Op> | <Op> <Operations>
White-spaces and new-lines are all ignored. And comments can put anywhere.
<Comment> ::= <CommentMarker> <LineString> <Newline>
<CommentMarker> ::= "#" | "//" | ";"
<LineString> ::= <any-char> | <any-char> <LineString>
<Newline> ::= "\r" | "\n"