| 1 |
%% |
| 2 |
%% rubikexamples.tex |
| 3 |
%% February 25, 2018 |
| 4 |
%% Requires ALL the rubik bundle packages and also the tikz package |
| 5 |
%% Part of the Rubik bundle v5.0 (www.ctan.org/pkg/rubik) |
| 6 |
%% authors: RWD Nickalls & A Syropoulos |
| 7 |
%%--------NOTE------------------------------------------- |
| 8 |
%% USAGE: (pdf)latex --shell-escape rubikexamples.tex |
| 9 |
%% run three times to get all labels and fig nos correct |
| 10 |
%%------------------------------------------------------- |
| 11 |
\documentclass[a4paper]{article} |
| 12 |
|
| 13 |
%------rubik---------- |
| 14 |
\usepackage{tikz} %% load tikz BEFORE rubikcube |
| 15 |
\usepackage{rubikcube,rubikrotation,rubikpatterns,rubiktwocube} |
| 16 |
%---------------------- |
| 17 |
\usepackage{url} |
| 18 |
\usepackage{ifpdf} |
| 19 |
\usepackage{lmodern} |
| 20 |
%--------------------- |
| 21 |
\ifpdf |
| 22 |
\usepackage[verbose]{microtype} |
| 23 |
\usepackage{cmap} |
| 24 |
\usepackage[pdfencoding=auto]{hyperref} |
| 25 |
|
| 26 |
\hypersetup{% |
| 27 |
pdftitle={rubikexamples.pdf}, |
| 28 |
pdfsubject={Rubik cube, Rubik bundle}, |
| 29 |
pdfkeywords={Rubik cube LaTeX} |
| 30 |
} |
| 31 |
\fi |
| 32 |
%%------------------- |
| 33 |
\pagestyle{myheadings} |
| 34 |
\markright{\texttt{rubikexamples.pdf} \ \ |
| 35 |
(Rubik bundle v5.0, 2018) \ \ \texttt{www.ctan.org/pkg/rubik}} |
| 36 |
|
| 37 |
%% increase text height and width |
| 38 |
\addtolength{\oddsidemargin}{-1.5cm} |
| 39 |
\addtolength{\textwidth}{3cm} |
| 40 |
\addtolength{\textheight}{1cm} |
| 41 |
%---------------------- |
| 42 |
%==========Rubik stuff================ |
| 43 |
%----edge sequences for 3x3x3 cubes-------------------------- |
| 44 |
\newcommand{\CycleThreeEdgesFlipTwo}{[CycleThreeEdgesFlipTwo],F,R,U,Rp,Up,Fp}% |
| 45 |
\newcommand{\cyclethreeedgesfliptwo}{\CycleThreeEdgesFlipTwo}% |
| 46 |
% |
| 47 |
%----corner sequences-------------------------- |
| 48 |
\newcommand{\AllYellow}{[allyellow],R,U,Rp,U,R,Up,Up,Rp}% = SUNE %cross -->allyellow |
| 49 |
\newcommand{\allyellow}{\AllYellow}% |
| 50 |
\newcommand{\CycleThreeCorners}{[cyclethreecorners],Lp,U,R,Up,L,U,Rp,Up}% |
| 51 |
\newcommand{\cyclethreecorners}{\CycleThreeCorners}% |
| 52 |
\newcommand{\SwapTwoCorners}{[swaptwocorners],Rp,F,Rp,B2,R,Fp,Rp,B2,R2,Up} |
| 53 |
\newcommand{\swaptwocorners}{\SwapTwoCorners} |
| 54 |
% |
| 55 |
%% brace and bracket macros |
| 56 |
\newcommand{\Rubikbracket}[1]{$\left(\mbox{#1}\right)$} |
| 57 |
\newcommand{\Rubikbrace}[1]{$\left\{\mbox{#1}\right\}$} |
| 58 |
\newcommand{\cubenumber}[1]{\strut\raisebox{1cm}{#1}} |
| 59 |
%----------------- |
| 60 |
% |
| 61 |
\begin{document} |
| 62 |
% |
| 63 |
\ifpdf\pdfbookmark[1]{Title}{Title}\fi |
| 64 |
\title{Rubik examples\\ |
| 65 |
\smallskip\normalsize\texttt{www.ctan.org/tex-archives/macros/latex/contrib/rubik/rubikexamples.pdf} |
| 66 |
\,\footnote{This file is part of the Rubik bundle v5.0. To generate this file, |
| 67 |
use the following command: \newline \texttt{\$ pdflatex --shell-escape rubikexamples.tex}}} |
| 68 |
\author{RWD Nickalls\,\footnote{email: \textsf{[email protected]}}% |
| 69 |
\ \ \& A Syropoulos\,\footnote{email: \textsf{[email protected]}}} |
| 70 |
\date{25 February, 2018 (Rubik bundle v5.0)} |
| 71 |
\maketitle |
| 72 |
\tableofcontents |
| 73 |
|
| 74 |
\pagebreak |
| 75 |
%%---------------------- |
| 76 |
\section{Preliminaries} |
| 77 |
These examples were generated using the \TeX\ |
| 78 |
Rubik bundle\,\footnote{\url{http://www.ctan.org/pkg/rubik}} v5.0. |
| 79 |
They assume some familiarity with the four packages \textsc{rubikcube}, |
| 80 |
\textsc{rubikrotation}, \textsc{rubikpatterns} and \textsc{rubiktwocube}. |
| 81 |
For~documentation see the following files: |
| 82 |
|
| 83 |
\begin{quote} |
| 84 |
\begin{verbatim} |
| 85 |
rubikcube.pdf 3x3x3 documentation |
| 86 |
rubikrotation.pdf commands for implementing rotation sequences |
| 87 |
rubikrotationPL.pdf documentation of rubikrotation.pl (Perl program) |
| 88 |
rubikpatterns.pdf small database of well-known 3x3x3 configurations |
| 89 |
rubikpatternsLIST.pdf shows all configurations in the rubikpatterns database |
| 90 |
rubiktwocube.pdf 2x2x2 documentation |
| 91 |
\end{verbatim} |
| 92 |
\end{quote} |
| 93 |
|
| 94 |
This file requires the following packages: \texttt{tikz, rubikcube, rubikrotation, |
| 95 |
rubikpatterns, rubiktwocube}; note that the \texttt{tikz} package must be loaded |
| 96 |
\textit{before} the \texttt{rubikcube} package. |
| 97 |
|
| 98 |
This file needs to be run using the \verb!--shell-escape! command-line option; |
| 99 |
for example: |
| 100 |
\begin{quote} |
| 101 |
\begin{verbatim} |
| 102 |
pdflatex --shell-escape rubikexample.tex |
| 103 |
\end{verbatim} |
| 104 |
\end{quote} |
| 105 |
This is because nearly all the examples make use of the \verb!\RubikRotation! |
| 106 |
command, which calls the Perl script \texttt{rubikrotation.pl}. |
| 107 |
If you do forget to use the \verb!--shell-escape! command-line switch, |
| 108 |
the file will still run, but all the cubes will remain in the initial |
| 109 |
unprocessed configuration\,\footnote{As a quick check, run this file |
| 110 |
(\texttt{rubikexamples.tex}) in a separate directory and look at Figure~1; |
| 111 |
if this appears as a `solved' cube then your system has failed to call the Perl |
| 112 |
script \texttt{rubikrotation.pl} correctly for some reason. The most likely |
| 113 |
causes of this are (a)~failure to invoke the \texttt{--shell-escape} command-line |
| 114 |
option correctly, or (b)~failure to use a configuration file correctly |
| 115 |
(ie your system can't find the Perl program)---search the \texttt{.log} file |
| 116 |
to see whether the file \texttt{rubikrotation.pl} has been used.}. |
| 117 |
|
| 118 |
\subsection{3x3x3 vs 2x2x2 command names} |
| 119 |
The introduction of the \textsc{rubiktwocube} package (Rubik bundle v5) |
| 120 |
has necessitated a few command name changes in order to avoid confusion |
| 121 |
(see the \textsc{rubikcube} package documentation \S\,3.1 for details). |
| 122 |
Consequently, command names containing the word `\texttt{Rubik}' denote |
| 123 |
a 3x3x3 cube action; similarly those containing the word `\texttt{Two}' |
| 124 |
denote a 2x2x2 cube action. |
| 125 |
|
| 126 |
\subsection{Environments} |
| 127 |
When using the Rubik bundle one sometimes needs to be mindful of the various |
| 128 |
\LaTeX\ environments in which Rubik commands are placed (e.g.,~the figure, |
| 129 |
minipage and TikZ picture environments), since these environments restrict |
| 130 |
the actions of commands they contain to the particular environment. |
| 131 |
The \verb!\ShowCube! command is also relevant here, since it is a |
| 132 |
minipage-wrapper for the TikZ picture environment. Only Rubik \verb!\Draw..! |
| 133 |
commands and TikZ commands (e.g.,~\verb!\draw! and \verb!\node!) |
| 134 |
actually need to be inside a TikZ picture environment, and hence |
| 135 |
inside a \verb!\ShowCube! command. |
| 136 |
|
| 137 |
This issue arises because the Rubik bundle allows you to create figures |
| 138 |
showing different stages during a sequence of rotations. Consequently |
| 139 |
the effects of commands executed inside an environment (especially |
| 140 |
commands which determine the colour-state or rotations), may not be |
| 141 |
apparent to subsequent commands outside that particular environment. |
| 142 |
See Example~3 for an illustration of how to handle environments. |
| 143 |
|
| 144 |
\pagebreak |
| 145 |
|
| 146 |
%%------------------ |
| 147 |
\section{RubikCube examples (3x3x3)} |
| 148 |
|
| 149 |
\subsection{Sixspot} |
| 150 |
\typeout{---Example (sixspot)} |
| 151 |
|
| 152 |
In Figure~\ref{fig:sixspot} we show the so-called ``sixspot'' configuration, |
| 153 |
generated from a solved cube using the rotation sequence |
| 154 |
\rr{U}, \rr{Dp}, \rr{R}, \rr{Lp}, \rr{F}, \rr{Bp}, \rr{U}, \rr{Dp}. |
| 155 |
|
| 156 |
%%--------FIGURE 1 ----------- |
| 157 |
\begin{figure}[hbt] |
| 158 |
\centering |
| 159 |
\RubikCubeSolvedWY |
| 160 |
\RubikRotation{\sixspot} |
| 161 |
\ShowCube{7cm}{0.7}{\DrawRubikCubeSF} |
| 162 |
\caption{\label{fig:sixspot}The `sixspot' configuration.} |
| 163 |
\end{figure} |
| 164 |
%---------------- |
| 165 |
|
| 166 |
{\noindent}Creating a macro to hold a rotation sequence greatly |
| 167 |
facilitates their use, as follows: |
| 168 |
\begin{quote} |
| 169 |
\begin{verbatim} |
| 170 |
\newcommand{\sixspot}{[sixspot],U,Dp,R,Lp,F,Bp,U,Dp} |
| 171 |
\end{verbatim} |
| 172 |
\end{quote} |
| 173 |
We can now process this sequence using its macro name as an argument |
| 174 |
for the \verb!\RubikRotation! command. The code used for the above |
| 175 |
Figure uses the \verb!\ShowCube{}{}{}! command for which \verb!#1! |
| 176 |
is the minipage width, \verb!#2! is the tikzpicture scale factor (0--1), |
| 177 |
and \verb!#3! can include \textsc{rubikcube} package \verb!\Draw..! |
| 178 |
commands, and any commands which are valid for use in a TikZ |
| 179 |
\texttt{tikzpicture} environment. The code for the above figure is |
| 180 |
as follows: |
| 181 |
|
| 182 |
\begin{quote} |
| 183 |
\begin{verbatim} |
| 184 |
\begin{figure}[hbt] |
| 185 |
\centering |
| 186 |
\RubikCubeSolvedWY |
| 187 |
\RubikRotation{\sixspot} |
| 188 |
\ShowCube{7cm}{0.7}{\DrawRubikCubeSF} |
| 189 |
\caption{...} |
| 190 |
\end{figure} |
| 191 |
\end{verbatim} |
| 192 |
\end{quote} |
| 193 |
|
| 194 |
Note that the sixspot sequence is a so-called `order~3' sequence, which |
| 195 |
means that running the `sixspot' sequence 3 times returns the cube |
| 196 |
to its original `solved' state. The~command for processing it three |
| 197 |
times is \verb!\RubikRotation[3]{\sixspot}!. |
| 198 |
|
| 199 |
Note that the semi-flat form of the cube here is generated by the |
| 200 |
\verb!\DrawRubikCubeSF! command, where the terminal SF denotes |
| 201 |
the Semi-Flat form. To draw it completely flat use a terminal F, |
| 202 |
e.g.,~\verb!\DrawRubikCubeF! (see Figure~\ref{fig:sixspotE}). |
| 203 |
|
| 204 |
\subsubsection{Log-file extract} |
| 205 |
Users may find it instructive to inspect the the log-file and |
| 206 |
follow the dynamic interaction between \LaTeX\ and the Perl script. |
| 207 |
This is easy to follow, since output by \texttt{rubikrotation.sty} |
| 208 |
is prefixed by 3 dashes (\verb!---!), while output by the Perl script |
| 209 |
is prefixed by 3 dots (\verb!...!). Search for the keyword `Example', |
| 210 |
as this is written to the log-file at the start of each example. |
| 211 |
|
| 212 |
The following is part of the log-file extract associated with Example~1. |
| 213 |
|
| 214 |
\begin{quote} |
| 215 |
\begin{verbatim} |
| 216 |
---Example (sixspot) |
| 217 |
|
| 218 |
---TeX process--------------------------- |
| 219 |
---script = rubikrotation.sty v5.0 (2018/02/25) |
| 220 |
---NEW rotation command |
| 221 |
---command = RubikRotation[1]{[SixSpot],U,Dp,R,Lp,F,Bp,U,Dp,<(8q*, 8f*)>} |
| 222 |
---writing current cube state to file rubikstate.dat |
| 223 |
\openout7 = `rubikstate.dat'. |
| 224 |
|
| 225 |
\ourRRcounter=\count134 |
| 226 |
---CALLing Perl script (rubikrotation.pl) |
| 227 |
runsystem(perl $HOME/RubikTeX/PERLstuff/dtx-rubikrotation/rubikrotation.pl |
| 228 |
-i rubikstate.dat -o rubikstateNEW.dat)...executed. |
| 229 |
|
| 230 |
---inputting NEW datafile (data written by Perl script) |
| 231 |
(./rubikstateNEW.dat |
| 232 |
|
| 233 |
...PERL process.................................. |
| 234 |
...script = rubikrotation.pl v5.0 (25 February 2018) |
| 235 |
...reading the current cube state (from File: rubikstate.dat) |
| 236 |
... |
| 237 |
...command = cubesize,three |
| 238 |
...cube = THREEcube |
| 239 |
... |
| 240 |
......up,W,W,W,W,W,W,W,W,W |
| 241 |
....down,Y,Y,Y,Y,Y,Y,Y,Y,Y |
| 242 |
....left,B,B,B,B,B,B,B,B,B |
| 243 |
...right,G,G,G,G,G,G,G,G,G |
| 244 |
...front,O,O,O,O,O,O,O,O,O |
| 245 |
....back,R,R,R,R,R,R,R,R,R |
| 246 |
... |
| 247 |
...rotation keyword |
| 248 |
...checking state of cube |
| 249 |
...cubiesum = 54 (Red=9, Or=9, Ye=9, Gr=9, Bl=9, Wh=9, X=0) |
| 250 |
... |
| 251 |
...command = rotation,[SixSpot],U,Dp,R,Lp,F,Bp,U,Dp,<(8q*, 8f*)> |
| 252 |
...dataline = rotation,[SixSpot],U,Dp,R,Lp,F,Bp,U,Dp,<(8q*; 8f*)> |
| 253 |
...[SixSpot] is a label OK |
| 254 |
...rotation U, OK |
| 255 |
...rotation Dp, OK |
| 256 |
...rotation R, OK |
| 257 |
...rotation Lp, OK |
| 258 |
...rotation F, OK |
| 259 |
...rotation Bp, OK |
| 260 |
...rotation U, OK |
| 261 |
...rotation Dp, OK |
| 262 |
...writing new cube state to file rubikstateNEW.dat |
| 263 |
...SequenceName = SixSpot |
| 264 |
...SequenceInfo = (8q*; 8f*) |
| 265 |
...SequenceShort = [SixSpot],U,Dp,R,Lp,F,Bp,U,Dp |
| 266 |
...SequenceLong = U,Dp,R,Lp,F,Bp,U,Dp |
| 267 |
) |
| 268 |
\end{verbatim} |
| 269 |
\end{quote} |
| 270 |
|
| 271 |
\pagebreak |
| 272 |
|
| 273 |
\subsection{ShowErrors} |
| 274 |
\typeout{---Example (ShowRubikErrors)} |
| 275 |
|
| 276 |
In this example we demonstrate the use of the \verb!\ShowErrors! |
| 277 |
command\,\footnote{ The \texttt{ {\textbackslash}ShowErrors} command |
| 278 |
replaces the earlier \texttt{{\textbackslash}ShowRubikErrors} command |
| 279 |
which is now deprecated. However, the earlier command is still |
| 280 |
supported (for now) for backward compatibility.}, |
| 281 |
which places a copy of the Perl output file \verb!rubikstateERRORS.dat! |
| 282 |
underneath the graphic so you can see a list of all the errors, if any. |
| 283 |
Note that this example is similar to the previous one except that we have |
| 284 |
introduced several errors---e.g.,~bad minipage width, typos, as well as |
| 285 |
some animals---into the rotation sequence). |
| 286 |
It is important to note that the \verb!\ShowErrors! command must be |
| 287 |
placed \textit{after} the TikZ picture environment (i.e.,~in this case after |
| 288 |
the \verb!\ShowCube! command), or even at the end of the document. |
| 289 |
Note that full details of all errors are also included in the .log file (search for \texttt{*ERR}). |
| 290 |
|
| 291 |
%%--------FIGURE 2 ----------- |
| 292 |
% |
| 293 |
\RubikCubeSolvedWY |
| 294 |
\RubikRotation{[sixspot],U,Dp,R,Lp,F,Bp,U,Dpppp,cat,dog} |
| 295 |
\begin{figure}[hbt] |
| 296 |
\centering |
| 297 |
\ShowCubeF{4.5cm}{0.5}{\DrawRubikCubeF} |
| 298 |
\ShowErrors |
| 299 |
\parbox{0.8\textwidth}{% |
| 300 |
\caption{\label{fig:sixspotE}The same `sixspot' sequence of rotations as shown |
| 301 |
in Example~1, but now with some errors (wrong minipage width, typos and some |
| 302 |
animals\,!) in the rotation sequence (it \textit{should} be just |
| 303 |
\texttt{U,Dp,R,Lp,F,Bp,U,Dp}).}} |
| 304 |
\end{figure} |
| 305 |
% |
| 306 |
{\noindent}In this example we have used the F version of the \verb!\ShowCube! |
| 307 |
command (\verb!\ShowCubeF!) which places an fbox around the image so you can see the |
| 308 |
extent of any white space etc. This reveals that the set minipage-width ($4.5$cm) in |
| 309 |
the \verb!\ShowCubeF! command---see code below---is too narrow: it should be |
| 310 |
5cm ($10 \times 0.5$) to just include the whole image (i.e.,~$10 \times$ the TikZ |
| 311 |
scale-factor in this case). |
| 312 |
Once fixed, we can remove the F from the \verb!\ShowCubeF! command. |
| 313 |
Note also that only `\verb!\Draw...!' commands really need to be inside the TikZ |
| 314 |
picture environment (i.e.,~inside the \verb!\ShowCube! command). The above figure |
| 315 |
was generated by the following code. |
| 316 |
%----------------- |
| 317 |
\begin{quote} |
| 318 |
\begin{verbatim} |
| 319 |
\RubikCubeSolvedWY |
| 320 |
\RubikRotation{[sixspot],U,Dp,R,Lp,F,Bp,U,Dpppp,cat,dog} |
| 321 |
\begin{figure}[hbt] |
| 322 |
\centering |
| 323 |
\ShowCubeF{4.5cm}{0.5}{\DrawRubikCubeF} |
| 324 |
\ShowErrors |
| 325 |
\caption{....} |
| 326 |
\end{figure} |
| 327 |
\end{verbatim} |
| 328 |
\end{quote} |
| 329 |
Even if the \verb!\ShowErrors! command is not used, it is always a good idea |
| 330 |
to check the file \verb!rubikstateERRORS.dat! after a \LaTeX\ run, since this |
| 331 |
file will also reveal any errors. |
| 332 |
|
| 333 |
|
| 334 |
\pagebreak |
| 335 |
%---------------------- |
| 336 |
|
| 337 |
\subsection{Environments} |
| 338 |
\typeout{---Example (Environments)} |
| 339 |
|
| 340 |
|
| 341 |
In this example we highlight the fact that Rubik commands used inside a \LaTeX\ |
| 342 |
environment remain local to that environment, and how this can sometimes be |
| 343 |
problematic. Commands whose reach is meant to be more global need to be |
| 344 |
executed outside such environments, where they can implement global colour |
| 345 |
settings, which will then be accessible to subsequent \verb!\Draw..! commands. |
| 346 |
|
| 347 |
Since we are drawing images, this is primarily an issue |
| 348 |
with the \verb!minipage!, \verb!figure!, and TikZ picture environments. |
| 349 |
Consequently, it is generally best when drawing a sequence of cubes to reserve |
| 350 |
the TikZ picture environment only for \verb!\Draw..! commands and TikZ |
| 351 |
commands. Importantly, this also applies to our main display tool the \verb!\ShowCube! |
| 352 |
command, since this is a minipage-wrapper for the TikZ picture environment |
| 353 |
(see the \textsc{rubikcube} package documentation). |
| 354 |
|
| 355 |
In this example the first cube (9a) uses a \verb!\RubikCubeSolvedWY! command |
| 356 |
\textit{inside} a \verb!\ShowCube! environment. However, if we now perform the |
| 357 |
rotation \textRubik{R}\ (using the command \verb!\RubikRotation{R}!) this results |
| 358 |
in a quite unexpected effect on cube (9b) (and obviously not correct). |
| 359 |
This is because the action of the initial \verb!\RubikCubeSolved! command |
| 360 |
(setting a new colour-state) is not visible outside its \verb!\ShowCube! |
| 361 |
environment, and hence the subsequent \verb!\RubikRotation{R}! command is unaware |
| 362 |
of this earlier attempt to update the global colour-state information. |
| 363 |
It turns out that the internal colour-state was actually last updated following |
| 364 |
the action of the \textbackslash\texttt{RubikRotation\{[sixspot],....\}} |
| 365 |
command used in Example~2, being the last colour-state command executed |
| 366 |
\textit{outside} an environment (a \texttt{figure} environment in that |
| 367 |
example). Consequently, the strange cube 9b is not what we expected. |
| 368 |
|
| 369 |
\medskip |
| 370 |
\noindent% |
| 371 |
\cubenumber{9a}% |
| 372 |
\ShowCube{2cm}{0.5}{% |
| 373 |
\RubikCubeSolvedWY% |
| 374 |
\DrawRubikCubeRU}% |
| 375 |
\quad\Rubik{R}% |
| 376 |
\RubikRotation{R}% |
| 377 |
\cubenumber{9b}% |
| 378 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 379 |
%--------------- |
| 380 |
\hspace{5mm} |
| 381 |
\begin{minipage}{0.5\textwidth} |
| 382 |
\begin{verbatim} |
| 383 |
\usepackage{tikz,rubikcube,rubikrotation} |
| 384 |
\newcommand{\cubenumber}[1]{\strut\raisebox{1cm}{#1}} |
| 385 |
... |
| 386 |
\cubenumber{9a}% |
| 387 |
\ShowCube{2cm}{0.5}{% |
| 388 |
\RubikCubeSolvedWY% |
| 389 |
\DrawRubikCubeRU% |
| 390 |
}% |
| 391 |
\quad\Rubik{R}% |
| 392 |
\RubikRotation{R}% |
| 393 |
\cubenumber{9b}% |
| 394 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 395 |
\end{verbatim} |
| 396 |
\end{minipage} |
| 397 |
|
| 398 |
\bigskip |
| 399 |
|
| 400 |
If we now bring the \verb!\RubikCubeSolvedWY! command out of the \verb!\ShowCube! |
| 401 |
environment and place it \textit{before} the \verb!\ShowCube! command (see cubes 9c, 9d), |
| 402 |
then its colour `state' information becomes globally accessible (i.e.,~colour-state |
| 403 |
gets updated) and therefore gets used by the subsequent \verb!\RubikRotation{R}! |
| 404 |
command, and hence the cube (9d) is now rendered correctly. |
| 405 |
|
| 406 |
\bigskip |
| 407 |
|
| 408 |
\noindent% |
| 409 |
\cubenumber{9c}% |
| 410 |
\RubikCubeSolvedWY% |
| 411 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 412 |
\quad\Rubik{R}% |
| 413 |
\RubikRotation{R}% |
| 414 |
\cubenumber{9d}% |
| 415 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 416 |
%--------------- |
| 417 |
\hspace{5mm} |
| 418 |
\begin{minipage}{0.5\textwidth} |
| 419 |
\begin{verbatim} |
| 420 |
\cubenumber{9c}% |
| 421 |
\RubikCubeSolvedWY% |
| 422 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 423 |
\quad\Rubik{R}% |
| 424 |
\RubikRotation{R}% |
| 425 |
\cubenumber{9d}% |
| 426 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 427 |
\end{minipage} |
| 428 |
\end{verbatim} |
| 429 |
\end{minipage} |
| 430 |
|
| 431 |
\bigskip |
| 432 |
|
| 433 |
Note that the horizontal space occupied by \texttt{9d} is almost exactly |
| 434 |
the same as \verb!\quad!, and so we don't need to include any additional |
| 435 |
space before the \verb!\cubenumber{9d}! command. |
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
\pagebreak |
| 440 |
%---------------------- |
| 441 |
\subsection{Coordinates} |
| 442 |
\typeout{---Example (coordinates)} |
| 443 |
|
| 444 |
|
| 445 |
For all cubes the origin of coordinates is defined as the bottom left corner of |
| 446 |
the \textsc{front} face. Consequently, it is easy to determine the coordinates |
| 447 |
of points and hence draw lines, circles, and place lettering or other objects |
| 448 |
using the standard TikZ \verb!\draw..! and \verb!\node..! commands. Note that for |
| 449 |
convenience point $P$ (bottom back left corner) is designed to be $(-1,-1)$ |
| 450 |
on the 2D view. (The~following diagram is Fig~1 from the \textsc{rubikcube} |
| 451 |
package documentation). |
| 452 |
|
| 453 |
\begin{figure}[hbt] |
| 454 |
\centering |
| 455 |
\RubikFaceFrontAll{X} % X = default = grey |
| 456 |
\ShowCube{5.6cm}{0.7}{% |
| 457 |
\DrawRubikFaceFront |
| 458 |
|
| 459 |
\draw[line join=round,line cap=round,ultra thick] (0,0) -- (0,4); % Y |
| 460 |
\draw[line join=round,line cap=round,ultra thick] (0,0) -- (4,0); % X |
| 461 |
|
| 462 |
%draw labels |
| 463 |
\node (Ylabel) at (-0.35, 3.8) {$Y$}; |
| 464 |
\node (Xlabel) at ( 3.8, -0.4) {$X$}; |
| 465 |
|
| 466 |
%%----------draw the Rubik faces-------- |
| 467 |
%% outline Front face |
| 468 |
\draw[line join=round,line cap=round,ultra thick]% |
| 469 |
(0,3) -- (-1,2) -- (-1,-1) -- (2,-1) -- (3,0); |
| 470 |
%% |
| 471 |
%% outline Down face |
| 472 |
\draw[line join=round,line cap=round,ultra thick]% |
| 473 |
(-1,-1) -- (0, 0); |
| 474 |
%% |
| 475 |
%% |
| 476 |
%% draw labels |
| 477 |
\node (Y0) at (-0.4, 0) [blue]{$0$}; |
| 478 |
\node (Y1) at (-0.4, 1) [blue]{$1$}; |
| 479 |
\node (Y2) at (-0.4, 2) [blue]{$2$}; |
| 480 |
\node (Y3) at (-0.4, 3) [blue]{$3$}; |
| 481 |
%% |
| 482 |
\node (X0) at (0, -0.5) [blue]{$0$}; |
| 483 |
\node (X1) at (1, -0.5) [blue]{$1$}; |
| 484 |
\node (X2) at (2, -0.5) [blue]{$2$}; |
| 485 |
\node (X3) at (3, -0.5) [blue]{$3$}; |
| 486 |
%% |
| 487 |
\node (P) at (-2.4, -1) [blue]{$P\,(-1,-1)$}; |
| 488 |
} |
| 489 |
\end{figure} |
| 490 |
|
| 491 |
{\noindent}The code for the figure is given below. |
| 492 |
|
| 493 |
We draw everything in the \verb!\ShowCube! environment; the \textsc{front} face |
| 494 |
in grey (colour code = \texttt{X}) using the Rubik command |
| 495 |
\verb!\DrawRubikFlatFront!, and then draw all the lines and text using standard |
| 496 |
TikZ commands. The correct minipage-width argument (5.6cm) for the |
| 497 |
\verb!\ShowCube! command is determined by trial-and-error, using the `fbox' |
| 498 |
form of the command (\verb!\ShowCubeF!), and then the `F' is removed |
| 499 |
($\rightarrow$ \verb!\ShowCube!). In order to avoid confusion, all Rubik commands |
| 500 |
start with a capital letter (e.g.,~\verb!\Draw..!), while all TikZ commands |
| 501 |
start with a lower-case letter (e.g.,~\verb!\draw..!). |
| 502 |
|
| 503 |
\begin{quote} |
| 504 |
\begin{verbatim} |
| 505 |
\begin{figure}[hbt] |
| 506 |
\centering |
| 507 |
\RubikFaceFrontAll{X}% X = default non-colour (grey) |
| 508 |
\ShowCube{5.6cm}{0.7}{% |
| 509 |
\DrawRubikFaceFront |
| 510 |
\draw[line join=round,line cap=round,ultra thick] (0,0) -- (0,4);% Yaxis |
| 511 |
\draw[line join=round,line cap=round,ultra thick] (0,0) -- (4,0);% Xaxis |
| 512 |
\node (Ylabel) at (-0.35, 3.8) {$Y$}; |
| 513 |
\node (Xlabel) at ( 3.8, -0.4) {$X$}; |
| 514 |
%% outline Left and Down faces |
| 515 |
\draw[line join=round,line cap=round,ultra thick]% |
| 516 |
(0,3) -- (-1,2) -- (-1,-1) -- (2,-1) -- (3,0); |
| 517 |
\draw[line join=round,line cap=round,ultra thick]% |
| 518 |
(-1,-1) -- (0, 0); |
| 519 |
\node (Y0) at (-0.4, 0) [blue]{$0$}; |
| 520 |
\node (Y1) at (-0.4, 1) [blue]{$1$}; |
| 521 |
\node (Y2) at (-0.4, 2) [blue]{$2$}; |
| 522 |
\node (Y3) at (-0.4, 3) [blue]{$3$}; |
| 523 |
\node (X0) at (0, -0.5) [blue]{$0$}; |
| 524 |
\node (X1) at (1, -0.5) [blue]{$1$}; |
| 525 |
\node (X2) at (2, -0.5) [blue]{$2$}; |
| 526 |
\node (X3) at (3, -0.5) [blue]{$3$}; |
| 527 |
\node (P) at (-2.4, -1) [blue]{$P\,(-1,-1)$}; |
| 528 |
} |
| 529 |
\end{figure} |
| 530 |
\end{verbatim} |
| 531 |
\end{quote} |
| 532 |
|
| 533 |
|
| 534 |
\pagebreak |
| 535 |
|
| 536 |
%---------------------- |
| 537 |
\subsection{Face notation} |
| 538 |
\typeout{---Example (face notation)} |
| 539 |
|
| 540 |
The following diagram is Fig~2 from the \textsc{rubikcube} package documentation. |
| 541 |
|
| 542 |
\begin{figure}[htb] |
| 543 |
\centering% |
| 544 |
\RubikFaceUpAll{Y} |
| 545 |
\RubikFaceFrontAll{G} |
| 546 |
\RubikFaceRightAll{O} |
| 547 |
\ShowCubeF{5cm}{0.6}{% |
| 548 |
\DrawRubikCubeRU% |
| 549 |
%%----------------- |
| 550 |
|
| 551 |
%% Right |
| 552 |
\draw[line width=2pt,color=blue,->] (3.5,2) -- (5.3, 2); |
| 553 |
\node (R) at (4.6, 2.5) [blue]{\textbf{\textsf{R}}}; |
| 554 |
\node (x) at (5.8, 2) [blue]{\textbf{\textsf{x}}}; |
| 555 |
|
| 556 |
%%Left |
| 557 |
\draw[line width=2pt,color=blue] (-0.2,2) -- (-1.5, 2); |
| 558 |
\node (L) at (-1.1, 2.5) [blue]{\textbf{\textsf{L}}}; |
| 559 |
|
| 560 |
%%Up |
| 561 |
\draw[line width=2pt,color=blue,->] (2, 3.5) -- (2, 5.5); |
| 562 |
\node (U) at (1.4, 4.7) [blue]{\textbf{\textsf{U}}}; |
| 563 |
\node (y) at (2, 6.1) [blue]{\textbf{\textsf{y}}}; |
| 564 |
|
| 565 |
%%Down |
| 566 |
\draw[line width=2pt,color=blue] (2, -0.2) -- (2, -1.5); |
| 567 |
\node (D) at (2.6, -1.1) [blue]{\textbf{\textsf{D}}}; |
| 568 |
|
| 569 |
|
| 570 |
%%Front |
| 571 |
\draw[line width=2pt,color=blue,->] (1.5, 1.5) -- (0, -1); |
| 572 |
\node (F) at (0.7, -0.7) [blue]{\textbf{\textsf{F}}}; |
| 573 |
\node (z) at (-0.3, -1.4) [blue]{\textbf{\textsf{z}}}; |
| 574 |
|
| 575 |
%%Back |
| 576 |
\draw[line width=2pt,color=blue] (3.2, 4.2) -- (4, 5.5); |
| 577 |
\node (B) at (4.4, 5) [blue]{\textbf{\textsf{B}}}; |
| 578 |
%% |
| 579 |
} |
| 580 |
\end{figure} |
| 581 |
|
| 582 |
{\noindent}The code for the figure is as follows |
| 583 |
(the origin $(0,0)$ is at the bottom left corner of the \textsc{front} (green) face). |
| 584 |
|
| 585 |
\begin{quote} |
| 586 |
\begin{verbatim} |
| 587 |
\begin{figure}[htb] |
| 588 |
\centering% |
| 589 |
\RubikFaceUpAll{Y} |
| 590 |
\RubikFaceFrontAll{G} |
| 591 |
\RubikFaceRightAll{O} |
| 592 |
\ShowCubeF{5cm}{0.6}{% |
| 593 |
\DrawRubikCubeRU% |
| 594 |
%% Right |
| 595 |
\draw[line width=2pt,color=blue,->] (3.5,2) -- (5.3, 2); |
| 596 |
\node (R) at (4.6, 2.5) [blue]{\textbf{\textsf{R}}}; |
| 597 |
\node (x) at (5.8, 2) [blue]{\textbf{\textsf{x}}}; |
| 598 |
%%Left |
| 599 |
\draw[line width=2pt,color=blue] (-0.2,2) -- (-1.5, 2); |
| 600 |
\node (L) at (-1.1, 2.5) [blue]{\textbf{\textsf{L}}}; |
| 601 |
%%Up |
| 602 |
\draw[line width=2pt,color=blue,->] (2, 3.5) -- (2, 5.5); |
| 603 |
\node (U) at (1.4, 4.7) [blue]{\textbf{\textsf{U}}}; |
| 604 |
\node (y) at (2, 6.1) [blue]{\textbf{\textsf{y}}}; |
| 605 |
%%Down |
| 606 |
\draw[line width=2pt,color=blue] (2, -0.2) -- (2, -1.5); |
| 607 |
\node (D) at (2.6, -1.1) [blue]{\textbf{\textsf{D}}}; |
| 608 |
%%Front |
| 609 |
\draw[line width=2pt,color=blue,->] (1.5, 1.5) -- (0, -1); |
| 610 |
\node (F) at (0.7, -0.7) [blue]{\textbf{\textsf{F}}}; |
| 611 |
\node (z) at (-0.3, -1.4) [blue]{\textbf{\textsf{z}}}; |
| 612 |
%%Back |
| 613 |
\draw[line width=2pt,color=blue] (3.2, 4.2) -- (4, 5.5); |
| 614 |
\node (B) at (4.4, 5) [blue]{\textbf{\textsf{B}}}; |
| 615 |
} |
| 616 |
\end{figure} |
| 617 |
\end{verbatim} |
| 618 |
\end{quote} |
| 619 |
|
| 620 |
|
| 621 |
\pagebreak |
| 622 |
|
| 623 |
%---------------------- |
| 624 |
\subsection{Grey cube} |
| 625 |
\label{sec:greycube} |
| 626 |
\typeout{---Example (grey cube)} |
| 627 |
|
| 628 |
When explaining elementary layer-1 moves, it can be useful to use the `grey cube' |
| 629 |
(\verb!\RubikCubeGreyWY!) ---White opposite Yellow--- as this sets up only |
| 630 |
the central cubie on each face. |
| 631 |
We have shown the first cube here in Semi-Flat (SF) mode simply to show how the grey |
| 632 |
cube is configured (note that a WB version (\verb!\RubikCubeGreyWB!) |
| 633 |
and an `all-grey' version (\verb!\RubikCubeAllGrey!) are also available. |
| 634 |
Note that all these grey cube commands will also accept |
| 635 |
the word `gray' (to be consistent with TikZ). |
| 636 |
|
| 637 |
In this example, we show how to position a single `flipped' white/orange edge |
| 638 |
cubie in the top layer. |
| 639 |
|
| 640 |
\begin{figure}[hbt] |
| 641 |
|
| 642 |
\centering% |
| 643 |
\RubikCubeGreyWY% |
| 644 |
|
| 645 |
\RubikFaceUp{X}{X}{X}% |
| 646 |
{X}{W}{O}% |
| 647 |
{X}{X}{X}% |
| 648 |
|
| 649 |
\RubikFaceRight{X}{W}{X} |
| 650 |
{X}{G}{X} |
| 651 |
{X}{X}{X} |
| 652 |
% |
| 653 |
\cubenumber{1}% |
| 654 |
\ShowCube{5cm}{0.5}{\DrawRubikCubeSF}% |
| 655 |
%------------------ |
| 656 |
\quad\Rubik{Rp}\RubikRotation{Rp} |
| 657 |
\cubenumber{2}% |
| 658 |
\ShowCube{2cm}{0.5}{\DrawRubikCube}% |
| 659 |
%----------------------- |
| 660 |
\quad\Rubik{Fp}\RubikRotation{Fp} |
| 661 |
\cubenumber{3}% |
| 662 |
\ShowCube{2cm}{0.5}{\DrawRubikCube}% |
| 663 |
%----------------------- |
| 664 |
\end{figure} |
| 665 |
|
| 666 |
|
| 667 |
{\noindent}The code for the figure is given below. |
| 668 |
After setting up the first cube, we then just use the \verb!\RubikRotation! |
| 669 |
command to generate the remaining cubes. |
| 670 |
The colours are coded as follows: R~(red), O~(orange), Y~(yellow), |
| 671 |
G~(green), B~(blue), W~(white), and X~(grey). |
| 672 |
|
| 673 |
\begin{quote} |
| 674 |
\begin{verbatim} |
| 675 |
\usepackage{tikz,rubikcube,rubikrotation} |
| 676 |
\newcommand{\cubenumber}[1]{\strut\raisebox{1cm}{#1}} |
| 677 |
... |
| 678 |
\begin{figure}[hbt] |
| 679 |
\centering |
| 680 |
% set up the first cube |
| 681 |
\RubikCubeGreyWY% |
| 682 |
\RubikFaceUp{X}{X}{X}% |
| 683 |
{X}{W}{O}% |
| 684 |
{X}{X}{X}% |
| 685 |
|
| 686 |
\RubikFaceRight{X}{W}{X} |
| 687 |
{X}{G}{X} |
| 688 |
{X}{X}{X} |
| 689 |
\cubenumber{1}% |
| 690 |
\ShowCube{5cm}{0.5}{\DrawRubikCubeSF}% |
| 691 |
% |
| 692 |
\quad\Rubik{Rp}\RubikRotation{Rp} |
| 693 |
\cubenumber{2}% |
| 694 |
\ShowCube{2cm}{0.5}{\DrawRubikCube}% |
| 695 |
% |
| 696 |
\quad\Rubik{Fp}\RubikRotation{Fp} |
| 697 |
\cubenumber{3}% |
| 698 |
\ShowCube{2cm}{0.5}{\DrawRubikCube}% |
| 699 |
\end{figure} |
| 700 |
\end{verbatim} |
| 701 |
\end{quote} |
| 702 |
|
| 703 |
|
| 704 |
\pagebreak |
| 705 |
|
| 706 |
%------------------------------- |
| 707 |
\subsection{Scramble a cube} |
| 708 |
\label{sec:scrambleacube} |
| 709 |
\typeout{---Example (scramble a cube)} |
| 710 |
|
| 711 |
In this example we use the \verb!\RubikRotation! command to scramble a `solved' |
| 712 |
Rubik cube via a sequence of 120 random rotations, using the following command |
| 713 |
(the details of the process can be seen in the \texttt{.log} file): |
| 714 |
\begin{quote} |
| 715 |
\begin{verbatim} |
| 716 |
\RubikRotation{random,120} |
| 717 |
\end{verbatim} |
| 718 |
\end{quote} |
| 719 |
On this occasion we draw the cube Flat (F) using the command \verb!\DrawRubikCubeF!. |
| 720 |
In this example, we also make use of the \verb!\SaveRubikState{}! command to save |
| 721 |
the configuration (state) displayed here in Figure~3 to a file |
| 722 |
(\texttt{rubikexampfig3.tex}) using \verb!\SaveRubikState{rubikexampfig3.tex}!, |
| 723 |
so we can display the same cube configuration later but in a different format |
| 724 |
(we show it again in the following example (Example~\ref{sec:saverubikstate}). |
| 725 |
Note that since we are using a random sequence, it follows that each |
| 726 |
time this file is run not only will a visually different cube be generated, |
| 727 |
but the same state will be shown both |
| 728 |
here and in Example~\ref{sec:saverubikstate}. |
| 729 |
%%--------FIGURE 3 ----------- |
| 730 |
\begin{figure}[hbt] |
| 731 |
\centering |
| 732 |
\RubikCubeSolvedWY |
| 733 |
\RubikRotation{random,120} |
| 734 |
\SaveRubikState{rubikexampfig3.tex} |
| 735 |
\ShowCubeF{6cm}{0.5}{\DrawRubikCubeF} |
| 736 |
\parbox{0.7\textwidth}{% |
| 737 |
\caption{\label{fig:randomone}This shows a cube generated by 120 random rotations}} |
| 738 |
\end{figure} |
| 739 |
%---------------- |
| 740 |
\begin{quote} |
| 741 |
\begin{verbatim} |
| 742 |
\usepackage{tikz,rubikcube,rubikrotation} |
| 743 |
... |
| 744 |
\begin{figure}[hbt] |
| 745 |
\centering\RubikCubeSolvedWY |
| 746 |
\RubikRotation{random,120} |
| 747 |
\SaveRubikState{rubikexampfig3.tex} |
| 748 |
\ShowCubeF{6cm}{0.5}{\DrawRubikCubeF} |
| 749 |
\caption{....} |
| 750 |
\end{figure} |
| 751 |
\end{verbatim} |
| 752 |
\end{quote} |
| 753 |
|
| 754 |
{\noindent}Q: How do we determine the minipage-width ($7.2$cm) in the |
| 755 |
\verb!\ShowCube! command? |
| 756 |
|
| 757 |
\smallskip |
| 758 |
|
| 759 |
{\noindent}A: The object is 12~cubie squares wide. Since the TikZ scale-factor |
| 760 |
argument of the \verb!\ShowCube! command (cms/unit length) in this |
| 761 |
case is set to~$0.5$, then the true width of the image will |
| 762 |
be $12 \times 0.5 = 6$\,cm. Note that here we have used the \verb!\ShowCubeF! |
| 763 |
command and so we can see that this is correct. Changing the scale-factor will |
| 764 |
change the image size and hence a new width argument will be required to just fit |
| 765 |
the image. |
| 766 |
|
| 767 |
Note that in this particular case (where there is only a single image in the |
| 768 |
`figure' environment), since the \verb!\ShowCube! command places the image |
| 769 |
(in a TikZ picture environment) centrally inside a minipage, the image will |
| 770 |
in fact be centrally placed in the \verb!\textwidth! provided the image |
| 771 |
is \textit{smaller} than the fbox---i.e.,~if we used instead a minipage-width of, |
| 772 |
say, 12\,cm the image would still appear centred in the \verb!\textwidth! in |
| 773 |
this case. However, when there are several images in the `figure', then the spacing |
| 774 |
may appear strange unless each image closely fits its own minipage-width etc. |
| 775 |
It is often useful, therefore, to check the size of the fbox (using the |
| 776 |
\verb!\ShowCubeF! command) as we have done here. |
| 777 |
|
| 778 |
|
| 779 |
\pagebreak |
| 780 |
|
| 781 |
%---------------------- |
| 782 |
\subsection{SaveRubikState} |
| 783 |
\label{sec:saverubikstate} |
| 784 |
\typeout{---Example (SaveRubikState)} |
| 785 |
|
| 786 |
In this example we display a cube having the same colour state as that shown in |
| 787 |
the previous example (Example~\ref{sec:scrambleacube}) ---see Figure~\ref{fig:randomone}. |
| 788 |
The cube's colour state was saved from the previous example using the command |
| 789 |
\verb!\SaveRubikState{rubikexampfig3.tex}!, and then input here |
| 790 |
using the command \verb!\input{rubikexampfig3.tex}!. These commands therefore allow the |
| 791 |
state of a previous cube to be saved to a file, and then displayed again |
| 792 |
later in a different format. |
| 793 |
|
| 794 |
%%-----------FIGURE 4 ----------- |
| 795 |
\begin{figure}[hbt] |
| 796 |
\centering |
| 797 |
\input{rubikexampfig3.tex} |
| 798 |
\ShowCube{4cm}{0.8}{\DrawRubikCubeLD} |
| 799 |
\parbox{0.7\textwidth}{% |
| 800 |
\caption{\label{fig:randomtwo} This shows a Rubik cube in exactly the same |
| 801 |
colour state as the one shown in Figure~\ref{fig:randomone}, but here displayed |
| 802 |
as a cube seen from the LD (Left-Down) viewpoint.}% |
| 803 |
}% |
| 804 |
\end{figure} |
| 805 |
|
| 806 |
%%--------------------------------- |
| 807 |
\begin{quote} |
| 808 |
\begin{verbatim} |
| 809 |
\usepackage{tikz,rubikcube,rubikrotation} |
| 810 |
... |
| 811 |
\begin{figure}[hbt] |
| 812 |
\centering |
| 813 |
\input{rubikexampfig3.tex} |
| 814 |
\ShowCube{4cm}{0.8}{\DrawRubikCubeLD} |
| 815 |
\parbox{0.7\textwidth}{% |
| 816 |
\caption{....}% |
| 817 |
}% |
| 818 |
\end{figure} |
| 819 |
\end{verbatim} |
| 820 |
\end{quote} |
| 821 |
|
| 822 |
\noindent\textsc{note}: The command \verb!\SaveRubikState{}! is part of the |
| 823 |
\textsc{rubikrotation} package; see the documentation for further details. |
| 824 |
|
| 825 |
|
| 826 |
\pagebreak |
| 827 |
|
| 828 |
%---------------------- |
| 829 |
\subsection{Series of cubes} |
| 830 |
\typeout{---Example (series of cubes)} |
| 831 |
|
| 832 |
Here we show a convenient way of displaying a series of small cubes showing |
| 833 |
the action of a sequence of rotations (\rr{U}, \rr{R}, \rr{F}) on a solved cube. |
| 834 |
|
| 835 |
\begin{figure}[hbt] |
| 836 |
\centering |
| 837 |
\RubikCubeSolvedWY% |
| 838 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 839 |
\quad\Rubik{U}\quad% |
| 840 |
\RubikRotation{U}% |
| 841 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 842 |
\quad\Rubik{R}\quad% |
| 843 |
\RubikRotation{R}% |
| 844 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 845 |
\quad\Rubik{F}\quad% |
| 846 |
\RubikRotation{F}% |
| 847 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 848 |
\caption{The rotations \rr{U}, \rr{R}, \rr{F}\ on a solved cube.} |
| 849 |
\end{figure} |
| 850 |
|
| 851 |
{\noindent}The code for the above sequence is as follows: |
| 852 |
\begin{quote} |
| 853 |
\begin{verbatim} |
| 854 |
\usepackage{tikz,rubikcube,rubikrotation} |
| 855 |
... |
| 856 |
\begin{figure}[hbt] |
| 857 |
\centering% |
| 858 |
\RubikCubeSolvedWY% |
| 859 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 860 |
\quad\Rubik{U}\quad% |
| 861 |
\RubikRotation{U}% |
| 862 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 863 |
\quad\Rubik{R}\quad% |
| 864 |
\RubikRotation{R}% |
| 865 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 866 |
\quad\Rubik{F}\quad% |
| 867 |
\RubikRotation{F}% |
| 868 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 869 |
\caption{The rotations \rr{U}, \rr{R}, \rr{F}\ on a solved cube.} |
| 870 |
\end{figure} |
| 871 |
\end{verbatim} |
| 872 |
\end{quote} |
| 873 |
|
| 874 |
{\noindent}\textsc{Note} 1: We start with the White-opposite-Yellow (WY) |
| 875 |
solved cube, using the command \verb!\RubikCubeSolvedWY!. |
| 876 |
A White-opposite-Blue (WB) solved cube is available as \verb!\RubikCubeSolvedWB!. |
| 877 |
|
| 878 |
\medskip |
| 879 |
|
| 880 |
{\noindent}\textsc{Note} 2: There are four different commands for typesetting |
| 881 |
3x3x3 rotation codes in various formats (a slightly different set of four |
| 882 |
commands are used for the equivalent 2x2x2 rotation codes). |
| 883 |
In~this (3x3x3) example, we have used two of them; for example: |
| 884 |
{\newline}\verb!\rr{U}! $\rightarrow$ \rr{U} \ (here the \verb!\rr{}! stands |
| 885 |
for `rubik rotation'), and also |
| 886 |
{\newline}\verb!\Rubik{U}! $\rightarrow$ \Rubik{U}. This command typesets |
| 887 |
both the hieroglyph and the rotation code vertically one above the other. |
| 888 |
The other two commands are as follows: |
| 889 |
{\newline}\verb!\rrh{U}! $\rightarrow$ \rrh{U} \ (here the \verb!\rrh{}! |
| 890 |
stands for `rubik rotation hieroglyph'), and also |
| 891 |
{\newline}\verb!\textRubik{U}! $\rightarrow$ \textRubik{U}. This command |
| 892 |
typesets both the rotation code and the hieroglyph on the same line one |
| 893 |
after the other. |
| 894 |
|
| 895 |
|
| 896 |
\pagebreak |
| 897 |
|
| 898 |
%---------------------- |
| 899 |
\subsection{Rotation sequence} |
| 900 |
\typeout{---Example (rotation sequence)} |
| 901 |
|
| 902 |
We now explore using the named Rubik cube rotation sequences and associated |
| 903 |
patterns available in the \textsc{rubikpatterns} package---a small macro database |
| 904 |
(see the \textsc{rubikpatterns} documentation, and also its companion file \texttt{rubikpatternsLIST.pdf}). Having the sequences available as macros is |
| 905 |
very convenient since (a)~it avoids making errors when typing them out, |
| 906 |
and (b)~allows the easy application of software tools. |
| 907 |
|
| 908 |
A Rubik pattern is the configuration generated by a sequence of rotations |
| 909 |
(or `moves') from some initial starting configuration (typically a `solved' |
| 910 |
configuration). For example, FourSpot is a well known pattern which we can |
| 911 |
generate from a solved Rubik cube using the macro \verb!\FourSpot!; it is |
| 912 |
defined in the \textsc{rubikpatterns} package as follows: |
| 913 |
\begin{quote} |
| 914 |
\begin{verbatim} |
| 915 |
\newcommand{\FourSpot}{[FourSpot],F2,B2,U,Dp,R2,L2,U,Dp,<(12q*, 8f*)>} |
| 916 |
\newcommand{\fourspot}{\FourSpot} |
| 917 |
\end{verbatim} |
| 918 |
\end{quote} |
| 919 |
Note that for convenience the macros names in the \textsc{rubikpatterns} package |
| 920 |
are defined in both upper and lower-case (i.e.,~the macros \verb!\FourSpot! |
| 921 |
and \verb!\fourspot! are identical). The following figure shows the FourSpot |
| 922 |
sequence and pattern. |
| 923 |
|
| 924 |
\bigskip |
| 925 |
|
| 926 |
\noindent% |
| 927 |
\RubikCubeSolvedWY% |
| 928 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRD} |
| 929 |
\RubikRotation{\FourSpot} |
| 930 |
\quad% |
| 931 |
\SequenceBraceA{FourSpot}{% |
| 932 |
\ShowSequence{}{\Rubik}{\SequenceLong}% |
| 933 |
} |
| 934 |
\quad% |
| 935 |
\ShowCube{5cm}{0.5}{\DrawRubikCubeSF} |
| 936 |
|
| 937 |
\bigskip |
| 938 |
|
| 939 |
{\noindent}The code for the above figure is as follows: |
| 940 |
|
| 941 |
|
| 942 |
\begin{quote} |
| 943 |
\begin{verbatim} |
| 944 |
\usepackage{tikz,rubikcube,rubikrotation,rubikpatterns} |
| 945 |
... |
| 946 |
\noindent% |
| 947 |
\RubikCubeSolvedWY% |
| 948 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRD} |
| 949 |
\RubikRotation{\FourSpot} |
| 950 |
\quad% |
| 951 |
\SequenceBraceA{FourSpot}{% |
| 952 |
\ShowSequence{}{\Rubik}{\SequenceLong}% |
| 953 |
} |
| 954 |
\quad% |
| 955 |
\ShowCube{5cm}{0.5}{\DrawRubikCubeSF} |
| 956 |
\end{verbatim} |
| 957 |
\end{quote} |
| 958 |
Note that we have spread the code slightly here in order to emphasise that |
| 959 |
the \verb!\ShowSequence! command is being used as an argument for the |
| 960 |
\verb!\SequenceBraceA! command (the `A' in the command \verb!\SequenceBraceA! |
| 961 |
denotes that the annotation is placed Above the sequence.) |
| 962 |
We have used a solved cube with the WY (White opposite Yellow) |
| 963 |
configuration (\verb!\RubikCubeSolvedWY!). |
| 964 |
The first cube is drawn from the RD (Right-Down) viewpoint (\verb!\DrawRubikCubeRD!). |
| 965 |
The second cube is drawn from the SF (Semi-Flat) viewpoint (\verb!\DrawRubikCubeSF!) |
| 966 |
so we can see all the faces. |
| 967 |
|
| 968 |
Note that we execute the \verb!\RubikRotation{}! command \textit{before} showing |
| 969 |
the sequence itself. This is because the Perl program (CALLed by |
| 970 |
\verb!\RubikRotation!) allocates the rotation sequence to the variable |
| 971 |
\verb!\SequenceLong! which we then display using the \verb!\ShowSequence! command |
| 972 |
(see the \textsc{rubikrotation} documentation for details). |
| 973 |
|
| 974 |
|
| 975 |
\pagebreak |
| 976 |
|
| 977 |
%---------------------- |
| 978 |
\subsection{SixTs} |
| 979 |
\typeout{---Example (SixTs)} |
| 980 |
|
| 981 |
A more interesting cube pattern is the SixTs configuration (from the |
| 982 |
\textsc{rubikpatterns} package), which we now show in a slightly |
| 983 |
different way (adding an extra face and also some cube sidebars), as follows: |
| 984 |
|
| 985 |
\bigskip |
| 986 |
|
| 987 |
\noindent\hfil% |
| 988 |
\RubikCubeSolvedWB |
| 989 |
\ShowCube{1.6cm}{0.4}{ |
| 990 |
\DrawRubikCubeRU |
| 991 |
\DrawRubikFlatDown{0}{-3.3}} |
| 992 |
\RubikRotation{\sixts} |
| 993 |
\quad\SequenceBraceA{SixTs}{\ShowSequence{,\ }{\texttt}{\SequenceLong}} |
| 994 |
\quad\ShowCube{3cm}{0.5}{ |
| 995 |
\DrawRubikCubeRU |
| 996 |
\DrawRubikCubeSidebarFL{RU} |
| 997 |
\DrawRubikCubeSidebarFD{RU} |
| 998 |
\DrawRubikCubeSidebarBR{RU} |
| 999 |
\DrawRubikCubeSidebarBU{RU} |
| 1000 |
} |
| 1001 |
|
| 1002 |
\hfil |
| 1003 |
|
| 1004 |
\bigskip |
| 1005 |
|
| 1006 |
This time we have started with a solved cube having the WB configuration |
| 1007 |
(White opposite Blue), which is generated using the command |
| 1008 |
\verb!\RubikCubeSolvedWB! |
| 1009 |
(we have added the \textsc{down} face (blue) below to reveal the colour of this |
| 1010 |
face---see note below). |
| 1011 |
|
| 1012 |
The rotation sequence is in `long-format' (expanded into |
| 1013 |
separate rotations), comma-separated and space, typewriter font, |
| 1014 |
using the command \verb!\ShowSequence{,\ }{\texttt}{\SequenceLong}!. |
| 1015 |
|
| 1016 |
The final image shows the sixT cube together with the main cube sidebars |
| 1017 |
indicating the colours of the adjacent facelets, |
| 1018 |
using the \verb!\DrawRubikCubeSidebarXX! commands. |
| 1019 |
The code for the above figure is as follows: |
| 1020 |
|
| 1021 |
\begin{quote} |
| 1022 |
\begin{verbatim} |
| 1023 |
\RubikCubeSolvedWB |
| 1024 |
\ShowCube{1.6cm}{0.4}{% |
| 1025 |
\DrawRubikCubeRU% |
| 1026 |
\DrawRubikFlatDown{0}{-3.3}% |
| 1027 |
} |
| 1028 |
\RubikRotation{\SixTs} |
| 1029 |
\quad\SequenceBraceA{SixTs}{% |
| 1030 |
\ShowSequence{,\ }{\texttt}{\SequenceLong}% |
| 1031 |
} |
| 1032 |
\quad\ShowCube{2cm}{0.5}{ |
| 1033 |
\DrawRubikCubeRU |
| 1034 |
\DrawRubikCubeSidebarFL{RU} |
| 1035 |
\DrawRubikCubeSidebarFD{RU} |
| 1036 |
\DrawRubikCubeSidebarBR{RU} |
| 1037 |
\DrawRubikCubeSidebarBU{RU} |
| 1038 |
} |
| 1039 |
\end{verbatim} |
| 1040 |
\end{quote} |
| 1041 |
|
| 1042 |
|
| 1043 |
|
| 1044 |
\subsubsection*{Notes} |
| 1045 |
|
| 1046 |
\begin{enumerate} |
| 1047 |
|
| 1048 |
\item We have drawn the \textsc{down} face of the first cube using the command |
| 1049 |
\verb!\DrawRubikFlatDown{0}{-3.3}! where the two arguments are the $x$ and |
| 1050 |
$y$ coordinates of the \textit{bottom left} corner of the \textsc{down} face |
| 1051 |
(blue); these $(x,y)$ arguments allow us to position the blue `flat' face in |
| 1052 |
relation to the cube. Note that the grid origin of a cube image (on the page) |
| 1053 |
coincides with the \textit{bottom left} corner of the \textsc{front} face |
| 1054 |
(green in this case). |
| 1055 |
|
| 1056 |
\item The first image is really just 4 units wide. This is because the 2D width |
| 1057 |
of the \textit{side} face (red) is designed to measure 1~unit wide in the |
| 1058 |
oblique view (similarly, the 2D height of the \textit{top} face also measures |
| 1059 |
just 1~unit). Consequently, since the TikZ scale factor used is $0.4$, then |
| 1060 |
the (minimum) width argument for its \verb!\ShowCube{}{}{}! command is |
| 1061 |
$4\times 0.4 = 1.6$cm., hence we have \verb!\ShowCube{1.6cm}{0.4}{...}!. |
| 1062 |
|
| 1063 |
\end{enumerate} |
| 1064 |
|
| 1065 |
|
| 1066 |
\pagebreak |
| 1067 |
|
| 1068 |
%---------------------- |
| 1069 |
\subsection[Cycle three edges]{Cycle three edges (flip two)} |
| 1070 |
\typeout{---Example (cycle three edges (flip two))} |
| 1071 |
|
| 1072 |
The following example illustrates a sequence used for cycling three edges, |
| 1073 |
which is often used in generating the `cross' formation while solving the |
| 1074 |
final layer. However, it is a useful exercise to perform this sequence on |
| 1075 |
a solved cube, as this reveals quite clearly its rather complex actions |
| 1076 |
(it~also swaps two pairs of corners). |
| 1077 |
|
| 1078 |
The black arrow (no flip) and magenta arrows (flip) indicate the \textsc{up} |
| 1079 |
face edge cubies which are cycled anti-clockwise by the sequence |
| 1080 |
\ShowSequence{,}{\rr}{F,R,U,Rp,Up,Fp}. The blue arrows indicate the associated |
| 1081 |
`collateral damage' actions (two pairs of corner cubies swap positions); |
| 1082 |
depending on the circumstances, these other actions may be an acceptable |
| 1083 |
cost since they can be fixed at a later stage. (This diagram is from |
| 1084 |
Section~13 in the \textsc{rubikcube} package documentation). |
| 1085 |
|
| 1086 |
Note that we include the \textsc{up}-face sidebars to reveal the remaining |
| 1087 |
facelet colours of the top layer (using the command \verb!\DrawRubikFaceUpSide!) |
| 1088 |
so we can see how the sequence makes the cubies rotate and turn as they move. |
| 1089 |
|
| 1090 |
\bigskip% |
| 1091 |
\noindent\hfil% |
| 1092 |
\RubikCubeSolvedWY% |
| 1093 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 1094 |
\quad\ShowCube{2.3cm}{0.5}{% |
| 1095 |
\DrawRubikFaceUpSide% |
| 1096 |
\draw[thick,->,color=magenta] (1.5,0.5) -- (2.4, 1.4); |
| 1097 |
\draw[thick,->] (2.5,1.5) -- (1.6, 2.4); |
| 1098 |
\draw[thick,->,color=magenta] (1.3, 2.3) -- (1.3, 0.5); |
| 1099 |
\draw[thick,<->, color=blue] (0.5,2.6) -- (2.5, 2.6); |
| 1100 |
\draw[thick,<->, color=blue] (0.5,0.3) -- (2.5, 0.3); |
| 1101 |
}% |
| 1102 |
\RubikRotation{\CycleThreeEdgesFlipTwo}% |
| 1103 |
\quad\ShowSequence{}{\Rubik}{\SequenceLong}\quad$\longrightarrow$\quad% |
| 1104 |
\ShowCube{2.3cm}{0.5}{\DrawRubikFaceUpSide}% |
| 1105 |
\hfil% |
| 1106 |
\bigskip% |
| 1107 |
|
| 1108 |
|
| 1109 |
{\noindent}The code for the figure is as follows |
| 1110 |
|
| 1111 |
|
| 1112 |
\begin{verbatim} |
| 1113 |
\newcommand{\CycleThreeEdgesFlipTwo}{F,R,U,Rp,Up,Fp}% |
| 1114 |
... |
| 1115 |
... |
| 1116 |
\RubikCubeSolved% |
| 1117 |
\ShowCube{2cm}{0.4}{\DrawRubikCubeRU}% |
| 1118 |
\quad\ShowCube{2.3cm}{0.4}{% |
| 1119 |
\DrawRubikFaceUpSide% |
| 1120 |
\draw[thick,->,color=magenta] (1.5,0.5) -- (2.4, 1.4); |
| 1121 |
\draw[thick,->] (2.5,1.5) -- (1.6, 2.4); |
| 1122 |
\draw[thick,->,color=magenta] (1.3, 2.3) -- (1.3, 0.5); |
| 1123 |
\draw[thick,<->, color=blue] (0.5,2.6) -- (2.5, 2.6); |
| 1124 |
\draw[thick,<->, color=blue] (0.5,0.3) -- (2.5, 0.3); |
| 1125 |
}% |
| 1126 |
\RubikRotation{\CycleThreeEdgesFlipTwo}% |
| 1127 |
\quad\ShowSequence{}{\Rubik}{\SequenceLong}\quad$\longrightarrow$\quad% |
| 1128 |
\ShowCube{2.3cm}{0.4}{\DrawRubikFaceUpSide}% |
| 1129 |
\end{verbatim} |
| 1130 |
|
| 1131 |
{\noindent}Note that the TikZ \verb!\draw! commands (for drawing the arrows |
| 1132 |
on the cube face) start with a lower-case letter, and also require a terminal |
| 1133 |
semicolon. |
| 1134 |
|
| 1135 |
|
| 1136 |
|
| 1137 |
|
| 1138 |
\pagebreak |
| 1139 |
%---------------------- |
| 1140 |
\subsection{Superflip} |
| 1141 |
\typeout{---Example (superflip)} |
| 1142 |
|
| 1143 |
|
| 1144 |
Once you can solve Rubik's cube, then an interesting exercise is to generate |
| 1145 |
the so-called `superflip' configuration, in which all the |
| 1146 |
corners are correctly solved, while all the edges are |
| 1147 |
flipped\,\footnote{See the `superflip' entry in \textit{Wikipedia}, and also |
| 1148 |
the Kociemba website (\url{www.kociemba.org/cube.htm}); particularly the page |
| 1149 |
\url{http://kociemba.org/math/oh.htm}}. |
| 1150 |
|
| 1151 |
%--------draw the images------------- |
| 1152 |
\begin{figure}[hbt] |
| 1153 |
\centering |
| 1154 |
\RubikCubeSolvedWY% |
| 1155 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 1156 |
\qquad$\longrightarrow$\qquad% |
| 1157 |
\RubikRotation{\superflip}% |
| 1158 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeLD}% |
| 1159 |
\qquad% |
| 1160 |
\ShowCube{5cm}{0.5}{\DrawRubikCubeSF}% |
| 1161 |
\caption{Two representations of the superflip configuration.} |
| 1162 |
\end{figure} |
| 1163 |
%---------------------- |
| 1164 |
|
| 1165 |
{\noindent}A superflip sequence converts the solved cube on the left |
| 1166 |
into the form on the right, using the command \verb!\RubikRotation{\superflip}!. |
| 1167 |
The code for the above figure is shown below (the~\verb!\superflip! macro |
| 1168 |
used here is from the \textsc{rubikpatterns} package). |
| 1169 |
\begin{verbatim} |
| 1170 |
\usepackage{tikz,rubikcube,rubikrotation,rubikpatterns} |
| 1171 |
... |
| 1172 |
\begin{figure}[hbt] |
| 1173 |
\centering |
| 1174 |
\RubikCubeSolvedWY% |
| 1175 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 1176 |
\qquad$\longrightarrow$\qquad% |
| 1177 |
\RubikRotation{\superflip}% |
| 1178 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeLD} |
| 1179 |
\qquad% |
| 1180 |
\ShowCube{5cm}{0.5}{\DrawRubikCubeSF} |
| 1181 |
\caption{...} |
| 1182 |
\end{figure} |
| 1183 |
\end{verbatim} |
| 1184 |
|
| 1185 |
|
| 1186 |
The following superflip sequence\,\footnote{This particular superflip |
| 1187 |
sequence (in the \textsc{rubikpatterns} package) is due to Reid (1995); |
| 1188 |
for details see the \textsc{rubikpatterns} package documentation, and |
| 1189 |
also \url{http://kociemba.org/math/oh.htm}. |
| 1190 |
Another 20-move superflip sequence (due to H Kociemba), is designated |
| 1191 |
as K32466 in \url{www.nickalls.org/dick/papers/tex/RUBIK20moves.zip}.} |
| 1192 |
has just 20 HTM rotations (Half Turn Metric: counting 180~degree turns |
| 1193 |
as just one `rotation'). Note that the \textsc{rubikpatterns} package |
| 1194 |
contains this particular superflip sequence as the macro \verb!\superflip! |
| 1195 |
(see \texttt{rubikpatterns.pdf}). Consequently the code |
| 1196 |
\verb!\ShowSequence{,}{\large\texttt}{\superflip}!, will typeset the sequence |
| 1197 |
as follows: |
| 1198 |
|
| 1199 |
\begin{center} |
| 1200 |
%% show the Short code |
| 1201 |
\ShowSequence{,}{\texttt}{\superflip} |
| 1202 |
\end{center} |
| 1203 |
Note that for convenience, the \textsc{rubikpatterns} package includes |
| 1204 |
the sequence name (in square brackets) as the first element of the |
| 1205 |
associated macro. This is possible since the contents of a comma-separated |
| 1206 |
square bracket are not actioned as a rotation by the \verb!\RubikRotation! |
| 1207 |
command. |
| 1208 |
|
| 1209 |
\pagebreak |
| 1210 |
|
| 1211 |
Next we present the same superflip sequence but without commas and in |
| 1212 |
the form of hieroglyphs, using the \verb!\Rubik! font, for which we |
| 1213 |
require the `expanded' \verb!\SequenceLong! form (since the `short form' |
| 1214 |
includes trailing digits---see Section~11 in the \textsc{rubikcube} |
| 1215 |
documentation), using the following code: |
| 1216 |
|
| 1217 |
\begin{quote} |
| 1218 |
\begin{verbatim} |
| 1219 |
\usepackage{tikz,rubikcube,rubikrotation,rubikpatterns} |
| 1220 |
... |
| 1221 |
\RubikCubeSolvedWY |
| 1222 |
\RubikRotation{\superflip} |
| 1223 |
\noindent\strut\hspace{-8mm}\ShowSequence{}{\Rubik}{\SequenceLong} |
| 1224 |
\end{verbatim} |
| 1225 |
\end{quote} |
| 1226 |
which gives |
| 1227 |
|
| 1228 |
|
| 1229 |
\bigskip |
| 1230 |
|
| 1231 |
\RubikCubeSolvedWY |
| 1232 |
\RubikRotation{\superflip} |
| 1233 |
\noindent\strut\hspace{-8mm}\ShowSequence{}{\Rubik}{\SequenceLong} |
| 1234 |
|
| 1235 |
|
| 1236 |
%%--------------------------------- |
| 1237 |
\bigskip |
| 1238 |
|
| 1239 |
\subsubsection*{Equivalent sequence} |
| 1240 |
|
| 1241 |
|
| 1242 |
Interestingly, the superflip sequence is actually equivalent to |
| 1243 |
\Rubikbrace{\Rubikbracket{\Rubik{Rm}\Rubik{U}}4, \Rubik{x}, |
| 1244 |
\Rubik{yp}}3 \ \ (Harris (2008), p151). |
| 1245 |
Furthermore we can readily demonstrate this, as we can process |
| 1246 |
this novel form of the sequence using some useful features of |
| 1247 |
the \verb!\RubikRotation! command, as follows: |
| 1248 |
|
| 1249 |
\begin{quote} |
| 1250 |
\begin{verbatim} |
| 1251 |
\RubikCubeSolvedWF |
| 1252 |
\RubikRotation[3]{[superflip],(Rm,U)4,x,yp,<Harris (2008), p151>} |
| 1253 |
\ShowCube{4cm}{0.4}{\DrawRubikCubeSF} |
| 1254 |
\end{verbatim} |
| 1255 |
\end{quote} |
| 1256 |
which generates the following |
| 1257 |
|
| 1258 |
%------------------- |
| 1259 |
\begin{figure}[hbt] |
| 1260 |
\centering |
| 1261 |
\RubikCubeSolvedWY |
| 1262 |
%%% \RubikRotation[3]{[shortsuper],(Rmp,Up)4,yp,x}% ORG |
| 1263 |
\RubikRotation[3]{[shortsuper],(Rm,U)4,x,yp,<Harris (2008), p151>} |
| 1264 |
\ShowCube{5cm}{0.5}{\DrawRubikCubeSF} |
| 1265 |
\end{figure} |
| 1266 |
%---------------------- |
| 1267 |
{\noindent}which is exactly the same configuration as before. |
| 1268 |
Note that to do this we made use of the `repeat' option \verb![3]! |
| 1269 |
as well as the \verb!(Rmp,Up)4! `repeat-block' in |
| 1270 |
the argument of the \verb!\RubikRotation! command above. |
| 1271 |
|
| 1272 |
|
| 1273 |
\pagebreak |
| 1274 |
|
| 1275 |
%---------------------- |
| 1276 |
\subsection{Inverse sequence} |
| 1277 |
\typeout{---Example (inverse sequence)} |
| 1278 |
|
| 1279 |
|
| 1280 |
Generating the inverse of a Rubik sequence involves (a)~reversing the |
| 1281 |
order of the sequence, and (b)~inverting each rotation in the sequence |
| 1282 |
(see Sections~5.1 and 5.1.1 in the \textsc{rubikrotation} package |
| 1283 |
documentation). |
| 1284 |
|
| 1285 |
From the grey-cube example~(\ref{sec:greycube}) we saw that the sixspot |
| 1286 |
sequence is: \verb!U,Dp,R,Lp,F,Bp,U,Dp!; its inverse is therefore |
| 1287 |
readily determined as \verb!D,Up,B,Fp,L,Rp,D,Up!. Note that this is |
| 1288 |
easy to check since the sequence generated by the \verb!\RubikRotation! |
| 1289 |
command is held by the macro \verb!\SequenceLong!. For~example, the |
| 1290 |
output of the following commands |
| 1291 |
\begin{quote} |
| 1292 |
\begin{verbatim} |
| 1293 |
\fbox{\strut\rule{0pt}{10pt}% |
| 1294 |
The inverse of the sixspot sequence is: |
| 1295 |
\RubikRotation{\sixspot,<inverse>} |
| 1296 |
\ShowSequence{,}{\texttt}{\SequenceLong}. |
| 1297 |
} |
| 1298 |
\end{verbatim} |
| 1299 |
\end{quote} |
| 1300 |
is \quad\fbox{\strut\rule{0pt}{10pt} % |
| 1301 |
The inverse of the sixspot sequence is: |
| 1302 |
\RubikRotation{\sixspot,<inverse>} |
| 1303 |
\ShowSequence{,}{\texttt}{\SequenceLong}. |
| 1304 |
} |
| 1305 |
|
| 1306 |
\bigskip |
| 1307 |
|
| 1308 |
A sequence and its inverse will annihilate each other when applied |
| 1309 |
consecutively. For example, in the following figure we start with |
| 1310 |
a solved cube and apply the sixspot sequence. Applying the inverse |
| 1311 |
of the sixspot sequence then results in the solved cube configuration |
| 1312 |
again. |
| 1313 |
|
| 1314 |
\newcommand{\sixspotarrow}{$\quad\overrightarrow{\strut\textsc{sixspot}}\quad$} |
| 1315 |
\newcommand{\sixspotINVarrow}{$\quad\overrightarrow{\strut\textsc{sixspotINV}}\quad$} |
| 1316 |
|
| 1317 |
\begin{figure}[hbt] |
| 1318 |
\centering |
| 1319 |
\RubikCubeSolvedWY% |
| 1320 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 1321 |
\RubikRotation{\sixspot}% |
| 1322 |
\sixspotarrow% |
| 1323 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 1324 |
\RubikRotation{\sixspot,<inverse>}% |
| 1325 |
\sixspotINVarrow% |
| 1326 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU} |
| 1327 |
\end{figure} |
| 1328 |
|
| 1329 |
{\noindent}The code for the above figure is as follows: |
| 1330 |
|
| 1331 |
\begin{verbatim} |
| 1332 |
\newcommand{\sixspotarrow}{$\quad\overrightarrow{\strut\textsc{sixspot}}\quad$} |
| 1333 |
\newcommand{\sixspotINVarrow}{$\quad\overrightarrow{\strut\textsc{sixspotINV}}\quad$} |
| 1334 |
... |
| 1335 |
\RubikCubeSolvedWY\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 1336 |
\RubikRotation{\sixspot}% |
| 1337 |
\sixspotarrow% |
| 1338 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}% |
| 1339 |
\RubikRotation{\sixspot,<inverse>}% |
| 1340 |
\sixspotINVarrow% |
| 1341 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU} |
| 1342 |
\end{verbatim} |
| 1343 |
|
| 1344 |
|
| 1345 |
A significant property of the superflip configuration is that it is its own |
| 1346 |
inverse. Consequently we can achieve a similar result simply by applying the |
| 1347 |
superflip sequence \textit{twice in succession}, as follows: |
| 1348 |
|
| 1349 |
\newcommand{\superfliparrow}{$\quad\overrightarrow{\strut\textsc{superflip}}\quad$} |
| 1350 |
|
| 1351 |
\begin{figure}[hbt] |
| 1352 |
\centering |
| 1353 |
\RubikCubeSolved% |
| 1354 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}\superfliparrow% |
| 1355 |
\RubikRotation{\superflip}% |
| 1356 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU}\superfliparrow% |
| 1357 |
\RubikRotation{\superflip}% |
| 1358 |
\ShowCube{2cm}{0.5}{\DrawRubikCubeRU} |
| 1359 |
\end{figure} |
| 1360 |
|
| 1361 |
|
| 1362 |
\pagebreak |
| 1363 |
|
| 1364 |
%------------------- |
| 1365 |
\subsection{OLL example} |
| 1366 |
|
| 1367 |
% ThreeCube YellowCross (from dnRUBIKsolution15) |
| 1368 |
\newcommand{\yellowcross}{[yellowcross],F,R,U,Rp,Up,Fp} |
| 1369 |
\newcommand{\arrow}[1]{$\overrightarrow{\strut\mbox{#1}}$} |
| 1370 |
\newcommand{\ShowYellowFace}{\ShowCube{2.6cm}{0.6}{\NoSidebar{X}\DrawRubikFaceUpSide}} |
| 1371 |
|
| 1372 |
Here we illustrate the use of the \verb!\NoSidebar! command (see the |
| 1373 |
\textsc{rubikcube} package documentation) to generate nice displays |
| 1374 |
of so-called OLL (Orientate Lower Layer) configurations, which are |
| 1375 |
typically rendered using the yellow face. |
| 1376 |
|
| 1377 |
For example, the following sequence shows an efficient |
| 1378 |
algorithm (sequence) for `solving' the OLL configuration shown |
| 1379 |
in cube~A (listed as OLL case~33 in Harris |
| 1380 |
(2008, page~61)\footnote{Harris D (2008). \textit{Speedsolving the cube}, |
| 1381 |
(Stirling Publishing Co, New York) {\newline}(\texttt{www.stirlingpublishing.com}) |
| 1382 |
[covers 2x2x2, 3x3x3, 4x4x4, 5x5x5 cubes].} and also on the Harris OLL webpage \url{http://www.cubestation/3x3x3/cfop/oll/ollprintablepage.php}). |
| 1383 |
|
| 1384 |
|
| 1385 |
%% Dan Harris case 33 (in his 2008 book) |
| 1386 |
\newcommand{\CaseXXXIII}{[caseHarris33],R, U, Rp, U, R, Up, Rp, Up, Rp, F, R, Fp} |
| 1387 |
% {\DH2008thth} |
| 1388 |
|
| 1389 |
\bigskip |
| 1390 |
|
| 1391 |
%% setup OLL position DH33 (Dan Harris) |
| 1392 |
\RubikCubeGreyAll |
| 1393 |
\RubikFaceUp{X}{Y}{Y} |
| 1394 |
{Y}{Y}{X} |
| 1395 |
{Y}{X}{X} |
| 1396 |
\RubikFaceBack XXY XXXXXX |
| 1397 |
\RubikFaceLeft XXX XXXXXX |
| 1398 |
\RubikFaceRight YYX XXXXXX |
| 1399 |
\RubikFaceFront XYX XXXXXX |
| 1400 |
% |
| 1401 |
\cubenumber{A}% |
| 1402 |
\ShowCube{2.6cm}{0.6}{\NoSidebar{X}\DrawRubikFaceUpSide}% |
| 1403 |
% |
| 1404 |
\RubikRotation{\CaseXXXIII}% |
| 1405 |
\quad\SequenceBraceA{OLLcase33Harris}{% |
| 1406 |
\ShowSequence{}{\Rubik}{\CaseXXXIII}% |
| 1407 |
}% |
| 1408 |
\quad$\longrightarrow$\quad% |
| 1409 |
\cubenumber{B}% |
| 1410 |
\ShowCube{2.6cm}{0.6}{\NoSidebar{X}\DrawRubikFaceUpSide}% |
| 1411 |
|
| 1412 |
\bigskip |
| 1413 |
|
| 1414 |
{\noindent}The code for the above figure is as follows (note that |
| 1415 |
the \verb!\NoSidebar{X}! command is placed inside the \verb!\ShowCube! |
| 1416 |
environment in order to limit its action). |
| 1417 |
|
| 1418 |
\begin{quote} |
| 1419 |
\begin{verbatim} |
| 1420 |
\newcommand{\cubenumber}[1]{\strut\raisebox{1cm}{#1}} |
| 1421 |
\newcommand{\CaseXXXIII}{[caseHarris33],R,U,Rp,U,R,Up,Rp,Up,Rp,F,R,Fp} |
| 1422 |
% |
| 1423 |
\RubikCubeGreyAll |
| 1424 |
\RubikFaceUp{X}{Y}{Y} |
| 1425 |
{Y}{Y}{X} |
| 1426 |
{Y}{X}{X} |
| 1427 |
\RubikFaceBack XXY XXXXXX |
| 1428 |
\RubikFaceLeft XXX XXXXXX |
| 1429 |
\RubikFaceRight YYX XXXXXX |
| 1430 |
\RubikFaceFront XYX XXXXXX |
| 1431 |
\cubenumber{A}% |
| 1432 |
\ShowCube{2.6cm}{0.6}{\NoSidebar{X}\DrawRubikFaceUpSide}% |
| 1433 |
\RubikRotation{\CaseXXXIII}% |
| 1434 |
\quad\SequenceBraceA{OLLcase33Harris}{% |
| 1435 |
\ShowSequence{}{\Rubik}{\CaseXXXIII}% |
| 1436 |
}% |
| 1437 |
\quad$\longrightarrow$\quad% |
| 1438 |
\cubenumber{B}% |
| 1439 |
\ShowCube{2.6cm}{0.6}{\NoSidebar{X}\DrawRubikFaceUpSide}% |
| 1440 |
\end{verbatim} |
| 1441 |
\end{quote} |
| 1442 |
Note that since we originally defined the OLL case~33 algorithm |
| 1443 |
(Harris 2008) as a macro, it follows that we could instead have |
| 1444 |
recovered the OLL~33 configuration (cube~A above) using the |
| 1445 |
inverse algorithm, as follows: |
| 1446 |
|
| 1447 |
\bigskip |
| 1448 |
|
| 1449 |
\RubikCubeGreyAll |
| 1450 |
\RubikFaceUpAll{Y} |
| 1451 |
\RubikRotation{<inverse>,\CaseXXXIII} |
| 1452 |
\ShowCube{2.6cm}{0.6}{\NoSidebar{X}\DrawRubikFaceUS}% |
| 1453 |
\hspace{1cm} |
| 1454 |
\begin{minipage}{4cm} |
| 1455 |
\begin{verbatim} |
| 1456 |
\RubikCubeGreyAll |
| 1457 |
\RubikFaceUpAll{Y} |
| 1458 |
\RubikRotation{<inverse>,\CaseXXXIII} |
| 1459 |
\ShowCube{2.6cm}{0.6}{\NoSidebar{X}\DrawRubikFaceUS} |
| 1460 |
\end{verbatim} |
| 1461 |
\end{minipage} |
| 1462 |
|
| 1463 |
\bigskip |
| 1464 |
|
| 1465 |
{\noindent}Note that in this last example we have used the more convenient |
| 1466 |
short-hand US (UpSide) version of the \verb!\DrawRubikFaceUpSide! command, |
| 1467 |
namely \verb!\DrawRubikFaceUS!. |
| 1468 |
|
| 1469 |
|
| 1470 |
|
| 1471 |
\pagebreak |
| 1472 |
%---------------------- |
| 1473 |
\subsection{Cube patterns} |
| 1474 |
\typeout{---Example (Cube patterns)} |
| 1475 |
|
| 1476 |
\newcommand{\CycleThreeUpEdges}{[CycleUpEdges],F2,U,Rm,Up,Up,Lm,U,Fp2} |
| 1477 |
\newcommand{\StripesOrtho}{[StripesOrtho],Lp,Fp,Rp,L,U,D, Rp,Dp,Lp,Bp,U2,Lp,Up,R,L,Up,F2,Rp,<Harris 2008, p150>} |
| 1478 |
|
| 1479 |
We now look at how the \verb!\RubikRotation! command can be used to |
| 1480 |
investigate cube patterns, which are typically shown only as a |
| 1481 |
regular cube. For example, consider the following interesting sequence |
| 1482 |
\linebreak\texttt{L' F' R' L U D R' D' L' B' U2 L' U' R L U' F2 R'} |
| 1483 |
(Harris 2008, page~150), which is presented as a cube with orthogonal |
| 1484 |
stripes (see figure~A). In order to show the pattern using the Rubik |
| 1485 |
bundle, it is often useful to first express the sequence as a macro. |
| 1486 |
In this particular case we need to adjust the Harris (2008) notation |
| 1487 |
slightly to make it compatible (ie, insert commas, change trailing |
| 1488 |
`primes' into a trailing `p'), give it a suitable name |
| 1489 |
(say, \verb![StripesOrtho]!), and, for completion, include the citation |
| 1490 |
in an `infoblock' ($<$...$>$), as follows: |
| 1491 |
|
| 1492 |
\begin{verbatim} |
| 1493 |
\newcommand{\StripesOrtho}{% |
| 1494 |
[StripesOrtho],Lp,Fp,Rp,L,U,D,Rp,Dp,Lp,Bp,U2,Lp,Up,R,L,Up,F2,Rp,<Harris 2008, p150>} |
| 1495 |
\end{verbatim} |
| 1496 |
We can now process it simply by using its macro-name as the argument for |
| 1497 |
the \verb!\RubikRotation! command; for example, the following code displays |
| 1498 |
it as figure~A. |
| 1499 |
|
| 1500 |
\begin{verbatim} |
| 1501 |
\RubikCubeSolved |
| 1502 |
\RubikRotation{\StripesOrtho} |
| 1503 |
\ShowCube{2.6cm}{0.6}{\DrawRubikCubeRU} |
| 1504 |
\end{verbatim} |
| 1505 |
|
| 1506 |
At first sight this looks like a nice example of orthogonal stripes, |
| 1507 |
but if we look at all the faces by rendering the cube in a Semi-Flat |
| 1508 |
(SF) view (using the command \verb!\DrawRubikCubeSF!) |
| 1509 |
---see~figure~B--- this reveals that unfortunately only five faces |
| 1510 |
actually have a center stripe. |
| 1511 |
|
| 1512 |
\bigskip |
| 1513 |
|
| 1514 |
\RubikCubeSolved |
| 1515 |
\RubikRotation{\StripesOrtho} |
| 1516 |
\cubenumber{A} |
| 1517 |
\ShowCube{2.6cm}{0.6}{\DrawRubikCubeRU} |
| 1518 |
\hspace{3cm} |
| 1519 |
\cubenumber{B} |
| 1520 |
\ShowCube{4cm}{0.4}{\DrawRubikCubeSF} |
| 1521 |
|
| 1522 |
\bigskip |
| 1523 |
|
| 1524 |
{\noindent}So the question is: can we improve on this and create a cube |
| 1525 |
with a fully orthogonal pattern, by swapping the relevant red/yellow |
| 1526 |
and blue/yellow edge cubies in the back layer? Since it is impossible |
| 1527 |
to swap just two edge cubies within the same layer in a 3x3x3 cube |
| 1528 |
without changing any other cubies, the answer is no. However, we are |
| 1529 |
able to cycle cleanly three edge cubies within one face, and a single |
| 1530 |
cycle could at least create the final stripe with only minimal collateral |
| 1531 |
damage. |
| 1532 |
|
| 1533 |
For example, if we rotate the whole cube using the rotation denoted |
| 1534 |
as \rr{Rcp} (= \verb!\rr{Rcp}!)\,\footnote{There are several equivalent |
| 1535 |
notations for this: \rr{Rcp} $\equiv$ \rr{xp} $\equiv$ \rr{CRp}; |
| 1536 |
the c and C denote a whole cube rotation.} to bring the \textsc{back} face to |
| 1537 |
the \textsc{up} position (as shown in figure~C), we can then cycle the three |
| 1538 |
\textsc{up} edge cubies UL, UR, UF clockwise using the following |
| 1539 |
`CycleThreeUpEdges' sequence: |
| 1540 |
\begin{verbatim} |
| 1541 |
\newcommand{\CycleThreeUpEdges}{F2,U,Rm,Up,Up,Lm,U,Fp2} |
| 1542 |
\end{verbatim} |
| 1543 |
We can combine these two actions using the command |
| 1544 |
\verb!\RubikRotation{Rcp,\CycleThreeUpEdges}!, which will then align the |
| 1545 |
three red facelets in the \textsc{up} face and form the final stripe |
| 1546 |
(see figure~D). |
| 1547 |
|
| 1548 |
\RubikCubeSolved |
| 1549 |
\RubikRotation{\StripesOrtho,Rcp} |
| 1550 |
\cubenumber{C} |
| 1551 |
\ShowCube{2.6cm}{0.6}\DrawRubikCubeRU |
| 1552 |
\hspace{3cm} |
| 1553 |
\RubikRotation{\CycleThreeUpEdges} |
| 1554 |
\cubenumber{D} |
| 1555 |
\ShowCube{4cm}{0.4}\DrawRubikCubeSF |
| 1556 |
|
| 1557 |
\medskip |
| 1558 |
|
| 1559 |
The downside, of course, is that a yellow and a white facelet are also |
| 1560 |
swapped in the top layer, but at least we now have a cube with six |
| 1561 |
mutually adjacent orthogonal central stripes\,! |
| 1562 |
|
| 1563 |
|
| 1564 |
\pagebreak |
| 1565 |
|
| 1566 |
%%=====================TWOcube stuff====================================== |
| 1567 |
%%======================================================================== |
| 1568 |
|
| 1569 |
\section{TwoCube examples (2x2x2)} |
| 1570 |
|
| 1571 |
\subsection{Commands \& notation} |
| 1572 |
|
| 1573 |
Regarding the 2x2x2 cube as a `TwoCube' (instead of a RubikCube) makes |
| 1574 |
the 2x2x2 commands very intuitive (assuming you are familiar with the |
| 1575 |
3x3x3 commands), since they are mostly obtained just by exchanging |
| 1576 |
the word `Rubik' in 3x3x3 commands for the word `Two'. For example, |
| 1577 |
|
| 1578 |
\medskip |
| 1579 |
|
| 1580 |
\verb!3x3x3!\quad\hspace{1cm}$\rightarrow$\quad\hspace{1cm}\verb!2x2x2! |
| 1581 |
|
| 1582 |
\smallskip |
| 1583 |
|
| 1584 |
\verb!\RubikCubeSolvedWY! $\rightarrow$ \verb!\TwoCubeSolvedWY! |
| 1585 |
|
| 1586 |
\verb!\RubikRotation!\qquad\ $\rightarrow$ \quad\verb!\TwoRotation! |
| 1587 |
|
| 1588 |
\verb!\SaveRubikState!\qquad\ $\rightarrow$ \quad\verb!\SaveTwoState! |
| 1589 |
|
| 1590 |
\medskip |
| 1591 |
|
| 1592 |
Note that although the 2x2x2 cube does not have any middle slices, one can still |
| 1593 |
actually use the 3x3x3 commands \verb!\RubikRotation! and \verb!\SaveRubikState! |
| 1594 |
in the usual way (because the corner cubies are still processed in |
| 1595 |
the usual way). However, in the interests of consistency |
| 1596 |
both of these commands have equivalent `Two' versions: namely |
| 1597 |
\verb!\TwoRotation! and \verb!\SaveTwoState!. |
| 1598 |
|
| 1599 |
Of course there are considerably fewer rotation codes and hieroglyphs |
| 1600 |
associated with the TwoCube (since there are no middle slices), and |
| 1601 |
their commands also mirror the 3x3x3 equivalents in the \textsc{rubikcube} |
| 1602 |
package; i.e.,~\verb!Rubik! $\rightarrow$ \verb!Two! and |
| 1603 |
\verb!r! $\rightarrow$ \verb!t!. Thus the changes associated with the |
| 1604 |
four key commands can be summarised as follows : |
| 1605 |
|
| 1606 |
\medskip |
| 1607 |
|
| 1608 |
\verb!3x3x3! \hphantom{$\rightarrow$} \verb!2x2x2! |
| 1609 |
|
| 1610 |
\smallskip |
| 1611 |
|
| 1612 |
\verb!\rr{}! $\rightarrow$ \verb!\tr{}! |
| 1613 |
|
| 1614 |
\verb!\rrh{}! $\rightarrow$ \verb!\trh{}! |
| 1615 |
|
| 1616 |
\verb!\Rubik{}! $\rightarrow$ \verb!\Two{}! |
| 1617 |
|
| 1618 |
\verb!\textRubik{}! $\rightarrow$ \verb!\textTwo{}! |
| 1619 |
|
| 1620 |
|
| 1621 |
%----------------------- |
| 1622 |
|
| 1623 |
\bigskip |
| 1624 |
|
| 1625 |
%------------------- |
| 1626 |
\subsection{Visualising white-space} |
| 1627 |
|
| 1628 |
This example shows how the F version of the \verb!\ShowCube{}{}{}! command can be useful for revealing excess white space. |
| 1629 |
|
| 1630 |
|
| 1631 |
|
| 1632 |
\bigskip |
| 1633 |
|
| 1634 |
\TwoCubeSolvedWB% |
| 1635 |
\ShowCubeF{3cm}{0.6}{\DrawTwoCubeRU}% |
| 1636 |
\quad\ShowCubeF{1.7cm}{0.6}{\DrawTwoFaceUS}% |
| 1637 |
\hspace{1cm} |
| 1638 |
\begin{minipage}{0.3\textwidth} |
| 1639 |
\begin{verbatim} |
| 1640 |
\TwoCubeSolvedWB% |
| 1641 |
\ShowCubeF{3cm}{0.6}{\DrawTwoCubeRU}% |
| 1642 |
\quad% |
| 1643 |
\ShowCubeF{1.7cm}{0.5}{\DrawTwoFaceUS}% |
| 1644 |
\end{verbatim} |
| 1645 |
\end{minipage} |
| 1646 |
|
| 1647 |
|
| 1648 |
\bigskip |
| 1649 |
|
| 1650 |
Both images above have an F-box drawn around them (so we can see the |
| 1651 |
extent of any white space) using the F version of the \verb!\ShowCube!$\{\mbox{\textit{width}}\}\{\mbox{\textit{scale-factor}}\}\{\}$ command, |
| 1652 |
namely \verb!\ShowCubeF{}{}{}!. Clearly the \verb!3cm! width we have |
| 1653 |
used for the first cube above is too much, and so in the second pair |
| 1654 |
of images below we have reduced this width for the first image to |
| 1655 |
its correct value of \verb!1.6cm!, and have removed the F from the |
| 1656 |
\verb!\ShowCubeF! command accordingly. |
| 1657 |
|
| 1658 |
\bigskip |
| 1659 |
|
| 1660 |
\quad% |
| 1661 |
\TwoCubeSolvedWB% |
| 1662 |
\ShowCube{1.6cm}{0.6}{\DrawTwoCubeRU}% |
| 1663 |
\quad% |
| 1664 |
\ShowCube{1.7cm}{0.6}{\DrawTwoFaceUS}% |
| 1665 |
\hspace{1cm} |
| 1666 |
\begin{minipage}{0.3\textwidth} |
| 1667 |
\begin{verbatim} |
| 1668 |
\TwoCubeSolvedWB% |
| 1669 |
\ShowCube{1.6cm}{0.6}{\DrawTwoCubeRU}% |
| 1670 |
\quad% |
| 1671 |
\ShowCube{1.7cm}{0.5}{\DrawTwoFaceUS}% |
| 1672 |
\end{verbatim} |
| 1673 |
\end{minipage} |
| 1674 |
|
| 1675 |
\bigskip |
| 1676 |
|
| 1677 |
Thus use of the F version of the the \verb!ShowCube! command allows |
| 1678 |
the user to easily determine---by trial \& error---the correct minipage |
| 1679 |
width for a particular cube. |
| 1680 |
|
| 1681 |
|
| 1682 |
\pagebreak |
| 1683 |
|
| 1684 |
%------------------- |
| 1685 |
\subsection{Flat and semi-flat formats} |
| 1686 |
|
| 1687 |
We can view the hidden faces of a cube using the semi-flat (SF) and |
| 1688 |
flat (F) versions of the \verb!\DrawTwoCube..! command as follows. |
| 1689 |
|
| 1690 |
In the first figure we have also used the F version of the |
| 1691 |
\verb!\ShowCube{}{}{}! command to reveal the size of the minipage |
| 1692 |
which contains the image. Notice that since the 2D width of the side |
| 1693 |
face (red) is approximately 1 unit, we can estimate that the total |
| 1694 |
width of the image will be 6 + 1 = 7 units, and hence as we have |
| 1695 |
specified a TikZ scale factor of 0.6, then the required width of |
| 1696 |
the minipage is approximately $4.2$ ($= 7 \times 0.6$) |
| 1697 |
---see Section~4.1 in the \textsc{rubikcube} package documentation |
| 1698 |
for details). |
| 1699 |
|
| 1700 |
\bigskip |
| 1701 |
|
| 1702 |
\begin{minipage}{0.3\textwidth} |
| 1703 |
\centering |
| 1704 |
\TwoCubeSolvedWB% |
| 1705 |
\ShowCubeF{4.2cm}{0.6}{\DrawTwoCubeSF}% |
| 1706 |
\end{minipage} |
| 1707 |
\hspace{2cm} |
| 1708 |
\begin{minipage}{0.3\textwidth} |
| 1709 |
\begin{verbatim} |
| 1710 |
\TwoCubeSolvedWB% |
| 1711 |
\ShowCubeF{4.2cm}{0.6}{\DrawTwoCubeSF}% |
| 1712 |
\end{verbatim} |
| 1713 |
\end{minipage} |
| 1714 |
|
| 1715 |
\bigskip |
| 1716 |
|
| 1717 |
\begin{minipage}{0.3\textwidth} |
| 1718 |
\centering |
| 1719 |
\TwoCubeSolvedWB% |
| 1720 |
\ShowCube{4.8cm}{0.6}{\DrawTwoCubeF}% |
| 1721 |
\end{minipage} |
| 1722 |
\hspace{2cm} |
| 1723 |
\begin{minipage}{0.3\textwidth} |
| 1724 |
\begin{verbatim} |
| 1725 |
\TwoCubeSolvedWB% |
| 1726 |
\ShowCube{4.8cm}{0.6}{\DrawTwoCubeF}% |
| 1727 |
\end{verbatim} |
| 1728 |
\end{minipage} |
| 1729 |
|
| 1730 |
|
| 1731 |
|
| 1732 |
\pagebreak |
| 1733 |
|
| 1734 |
%------------------- |
| 1735 |
\subsection{Grey cube} |
| 1736 |
|
| 1737 |
|
| 1738 |
A cube with all of the facelets coloured grey (a `grey' cube) can be |
| 1739 |
useful as a starting state for instruction. Such a cube is generated |
| 1740 |
by the command \verb!\TwoCubeGreyAll!. |
| 1741 |
We can then allocate colours to those facelets demonstrating |
| 1742 |
some feature of cube manipulation. |
| 1743 |
Here we are showing how to rotate the GWR corner cubie in the bottom layer |
| 1744 |
up into its `solved' position in the top layer. We also use two cube |
| 1745 |
sidebars to show the colours of the hidden facelets of the corner cubie. |
| 1746 |
|
| 1747 |
\bigskip |
| 1748 |
|
| 1749 |
|
| 1750 |
\noindent\hfil% |
| 1751 |
\TwoCubeGrey |
| 1752 |
\ShowCube{2cm}{0.7}{\DrawTwoCube}% |
| 1753 |
% |
| 1754 |
\TwoFaceUp{X}{X} |
| 1755 |
{R}{W}% |
| 1756 |
\TwoFaceFront{G}{R} |
| 1757 |
{W}{X}% |
| 1758 |
\TwoFaceLeft XX |
| 1759 |
XG% |
| 1760 |
\TwoFaceDown{R}{X} |
| 1761 |
{X}{X}% |
| 1762 |
\quad\ShowCube{2cm}{0.7}{ |
| 1763 |
\DrawTwoCube |
| 1764 |
\DrawTwoCubeSidebarFD{RU} |
| 1765 |
\DrawTwoCubeSidebarFL{RU} |
| 1766 |
}% |
| 1767 |
\quad\Two{Lp}\quad |
| 1768 |
\TwoRotation{Lp} |
| 1769 |
\ShowCube{2cm}{0.7}{\DrawTwoCube}% |
| 1770 |
\hfil% |
| 1771 |
|
| 1772 |
\bigskip |
| 1773 |
|
| 1774 |
{\noindent}The code for the above figure is as follows: |
| 1775 |
\begin{quote} |
| 1776 |
\begin{verbatim} |
| 1777 |
\noindent\hfil% |
| 1778 |
\TwoCubeGrey |
| 1779 |
\ShowCube{2cm}{0.6}{\DrawTwoCube}% |
| 1780 |
% |
| 1781 |
\TwoFaceUp{X}{X} |
| 1782 |
{R}{W}% |
| 1783 |
\TwoFaceFront{G}{R} |
| 1784 |
{W}{X}% |
| 1785 |
\TwoFaceLeft XX |
| 1786 |
XG% |
| 1787 |
\TwoFaceDown{R}{X} |
| 1788 |
{X}{X}% |
| 1789 |
\ShowCube{2cm}{0.6}{ |
| 1790 |
\DrawTwoCube |
| 1791 |
\DrawTwoCubeSidebarFD{RU} |
| 1792 |
\DrawTwoCubeSidebarFL{RU} |
| 1793 |
}% |
| 1794 |
\quad\Two{Lp}\quad |
| 1795 |
\TwoRotation{Lp} |
| 1796 |
\ShowCube{2cm}{0.6}{\DrawTwoCube}% |
| 1797 |
\hfil% |
| 1798 |
\end{verbatim} |
| 1799 |
\end{quote} |
| 1800 |
Notice that the curly brackets associated with the \verb!\TwoFace..! commands |
| 1801 |
can be omitted providing at least one space is left before the first colour code |
| 1802 |
(see the \verb!\TwoFaceLeft..! command above). |
| 1803 |
|
| 1804 |
|
| 1805 |
\pagebreak |
| 1806 |
|
| 1807 |
%------------------- |
| 1808 |
\subsection{Scrambled cube} |
| 1809 |
|
| 1810 |
In the following example we scramble the cube using 20 random rotations using |
| 1811 |
$\langle$\texttt{random,20}$\rangle$ as the argument |
| 1812 |
for the \verb!\TwoRotation{}! command. We have also added a set of cube sidebars |
| 1813 |
to the second cube. The final semi-flat (SF) cube has the same colour configuration |
| 1814 |
and shows the hidden faces, allowing you to check the colours of the sidebars. |
| 1815 |
|
| 1816 |
\bigskip |
| 1817 |
|
| 1818 |
\noindent\hfil% |
| 1819 |
\TwoCubeSolvedWY% |
| 1820 |
\ShowCube{1.8cm}{0.7}{\DrawTwoCubeRU}% |
| 1821 |
\qquad$\longrightarrow$\qquad% |
| 1822 |
%--------------- |
| 1823 |
\TwoRotation{random,20} |
| 1824 |
%---------------- |
| 1825 |
\ShowCube{2.8cm}{0.7}{ |
| 1826 |
\DrawTwoCubeRU |
| 1827 |
\DrawTwoCubeSidebarFL{RU} % Front-Left edge sidebar |
| 1828 |
\DrawTwoCubeSidebarFD{RU} % Front-Down edge |
| 1829 |
\DrawTwoCubeSidebarBR{RU} % Back-Right edge |
| 1830 |
\DrawTwoCubeSidebarBU{RU} % Back-Up edge |
| 1831 |
}% |
| 1832 |
\qquad\ShowCube{5cm}{0.7}{\DrawTwoCubeSF}% |
| 1833 |
\hfil% |
| 1834 |
|
| 1835 |
\bigskip |
| 1836 |
|
| 1837 |
|
| 1838 |
\begin{quote} |
| 1839 |
\begin{verbatim} |
| 1840 |
\noindent\hfil% |
| 1841 |
\TwoCubeSolvedWY% |
| 1842 |
\ShowCube{1.8cm}{0.7}{\DrawTwoCubeRU}% |
| 1843 |
\qquad$\longrightarrow$\qquad% |
| 1844 |
%--------------- |
| 1845 |
\TwoRotation{random,20} |
| 1846 |
%---------------- |
| 1847 |
\ShowCube{2.8cm}{0.7}{ |
| 1848 |
\DrawTwoCubeRU |
| 1849 |
\DrawTwoCubeSidebarFL{RU} % Front-Left edge sidebar |
| 1850 |
\DrawTwoCubeSidebarFD{RU} % Front-Down edge |
| 1851 |
\DrawTwoCubeSidebarBR{RU} % Back-Right edge |
| 1852 |
\DrawTwoCubeSidebarBU{RU} % Back-Up edge |
| 1853 |
}% |
| 1854 |
\qquad\ShowCube{5cm}{0.7}{\DrawTwoCubeSF}% |
| 1855 |
\hfil% |
| 1856 |
\end{verbatim} |
| 1857 |
\end{quote} |
| 1858 |
|
| 1859 |
|
| 1860 |
|
| 1861 |
%------------------- |
| 1862 |
\subsubsection*{A simple scramble} |
| 1863 |
|
| 1864 |
A simple scramble (from a solved position) which |
| 1865 |
makes each face have four different facelets is $\left\{\mbox{\tr{R}, |
| 1866 |
\tr{y}}\right\}$5 as follows (note that the optional \verb!\TwoRotation! |
| 1867 |
square bracket holds the repeat number~$5$): |
| 1868 |
|
| 1869 |
\bigskip |
| 1870 |
|
| 1871 |
\begin{minipage}{0.3\textwidth} |
| 1872 |
\centering |
| 1873 |
\TwoCubeSolvedWB% |
| 1874 |
\TwoRotation[5]{R,y}% |
| 1875 |
\ShowCube{5cm}{0.6}{\DrawTwoCubeF}% |
| 1876 |
\end{minipage} |
| 1877 |
\hspace{2cm} |
| 1878 |
\begin{minipage}{0.3\textwidth} |
| 1879 |
\begin{verbatim} |
| 1880 |
\TwoCubeSolvedWB% |
| 1881 |
\TwoRotation[5]{R,y}% |
| 1882 |
\ShowCube{5cm}{0.6}{\DrawTwoCubeF}% |
| 1883 |
\end{verbatim} |
| 1884 |
\end{minipage} |
| 1885 |
|
| 1886 |
|
| 1887 |
\pagebreak |
| 1888 |
|
| 1889 |
%------------------- |
| 1890 |
\subsection{Swap two corners} |
| 1891 |
|
| 1892 |
The following example is the header figure for the \textsc{rubiktwocube} |
| 1893 |
package documentation, and shows the `SwapTwoCorners' sequence often |
| 1894 |
necessary in the solution of a 2x2x2 cube. |
| 1895 |
|
| 1896 |
\bigskip |
| 1897 |
|
| 1898 |
\noindent\hfil% |
| 1899 |
%% set up the cube with corners swapped |
| 1900 |
\TwoCubeSolvedWY% |
| 1901 |
\TwoRotation{Rc2}% turn upside down (= Rc2) x2 |
| 1902 |
\TwoRotation{\swaptwocorners}% |
| 1903 |
%% |
| 1904 |
% now show the cube, before and after swapping the corners again |
| 1905 |
\ShowCube{1.6cm}{0.6}{\DrawTwoCubeRU}% |
| 1906 |
\quad\ShowCube{1.7cm}{0.5}{\DrawTwoFaceUS}% |
| 1907 |
\TwoRotation{\swaptwocorners}% |
| 1908 |
\quad\SequenceBraceA{SwapTwoCorners}{\ShowSequence{}{\Two}{\SequenceLong}}% |
| 1909 |
\quad$\longrightarrow$% |
| 1910 |
\quad\ShowCube{1.7cm}{0.5}{\DrawTwoFaceUS}% |
| 1911 |
\hfil% |
| 1912 |
|
| 1913 |
\bigskip% |
| 1914 |
|
| 1915 |
{\noindent}The code for the above figure is as follows: |
| 1916 |
\begin{verbatim} |
| 1917 |
\usepackage{tikz} |
| 1918 |
\usepackage{rubikcube,rubikrotation,rubikpatterns,rubiktwocube} |
| 1919 |
... |
| 1920 |
\newcommand{\SwapTwoCorners}{[swaptwocorners],Rp,F,Rp,B2,R,Fp,Rp,B2,R2,Up} |
| 1921 |
\newcommand{\swaptwocorners}{\SwapTwoCorners} |
| 1922 |
... |
| 1923 |
\noindent |
| 1924 |
\hfil% |
| 1925 |
%% set up the cube with corners swapped |
| 1926 |
\TwoCubeSolvedWY% |
| 1927 |
\TwoRotation{Rc2}% turn cube upside down about the R face |
| 1928 |
\TwoRotation{\swaptwocorners}% |
| 1929 |
%% now show the cube, before and after swapping the corners |
| 1930 |
\ShowCube{1.6cm}{0.6}{\DrawTwoCubeRU}% |
| 1931 |
\quad\ShowCube{1.7cm}{0.5}{\DrawTwoFaceUS}% |
| 1932 |
\TwoRotation{\swaptwocorners}% |
| 1933 |
\quad\SequenceBraceA{SwapTwoCorners}{\ShowSequence{}{\Two}{\SequenceLong}}% |
| 1934 |
\quad$\longrightarrow$% |
| 1935 |
\quad\ShowCube{1.7cm}{0.5}{\DrawTwoFaceUS}% |
| 1936 |
\hfil% |
| 1937 |
\end{verbatim} |
| 1938 |
|
| 1939 |
\pagebreak |
| 1940 |
|
| 1941 |
%------------------- |
| 1942 |
\subsection{OLL example} |
| 1943 |
|
| 1944 |
Here we illustrate an OLL algorithm which orientates the last layer |
| 1945 |
starting from a single yellow facelet in the UFL position. |
| 1946 |
|
| 1947 |
\bigskip |
| 1948 |
|
| 1949 |
\noindent\hfil% |
| 1950 |
\TwoCubeGreyAll% |
| 1951 |
\TwoFaceUp{X}{X}% |
| 1952 |
{Y}{X}% |
| 1953 |
\TwoFaceBack XY XX |
| 1954 |
\TwoFaceRight XY XX% |
| 1955 |
\TwoFaceFront XY XX% |
| 1956 |
\ShowCube{2cm}{0.7}{\NoSidebar{X}\DrawTwoFaceUS} |
| 1957 |
\SaveTwoState{cubeTWO.tex} %*** |
| 1958 |
\TwoRotation{\allyellow}% |
| 1959 |
\quad\SequenceBraceA{AllYellow}{\ShowSequence{}{\Two}{\SequenceLong}}\quad$\longrightarrow$\quad% |
| 1960 |
\ShowCube{1.5cm}{0.7}{\NoSidebar{X}\DrawTwoFaceUS} |
| 1961 |
\hfil% |
| 1962 |
|
| 1963 |
\bigskip |
| 1964 |
|
| 1965 |
The code is shown below. Note that we have used the \verb!\NoSidebar{X}! |
| 1966 |
command to disable the drawing of any grey sidebars by the \verb!\DrawTwoFaceUS! |
| 1967 |
command\footnote{Note that the \textbackslash\texttt{DrawTwoFaceUS} command is a short-hand |
| 1968 |
equivalent to the \textbackslash\texttt{DrawTwoFaceUpSide} command.} |
| 1969 |
and hence only yellow sidebars are drawn. Note that we have placed the |
| 1970 |
\verb!\NoSidebar{X}! command inside the \verb!\ShowCube! environment in order |
| 1971 |
to limit its action locally. |
| 1972 |
|
| 1973 |
\begin{quote} |
| 1974 |
\begin{verbatim} |
| 1975 |
\noindent\hfil% |
| 1976 |
\TwoCubeGreyAll% |
| 1977 |
\TwoFaceUp{X}{X}% |
| 1978 |
{Y}{X}% |
| 1979 |
\TwoFaceBack XY XX |
| 1980 |
\TwoFaceRight XY XX% |
| 1981 |
\TwoFaceFront XY XX% |
| 1982 |
\ShowCube{2cm}{0.7}{\NoSidebar{X}\DrawTwoFaceUS}% |
| 1983 |
\TwoRotation{\allyellow}% |
| 1984 |
\quad\SequenceBraceA{AllYellow}{\ShowSequence{}{\Two}{\SequenceLong}}% |
| 1985 |
\quad$\longrightarrow$\quad% |
| 1986 |
\ShowCube{1.5cm}{0.7}{\NoSidebar{X}\DrawTwoFaceUS}% |
| 1987 |
\hfil% |
| 1988 |
\end{verbatim} |
| 1989 |
\end{quote} |
| 1990 |
|
| 1991 |
\bigskip |
| 1992 |
|
| 1993 |
|
| 1994 |
\begin{center} |
| 1995 |
------ END ------ |
| 1996 |
\end{center} |
| 1997 |
|
| 1998 |
\end{document} |