RUBIK-LRUBIKS RUBIK-L!BOOT 3 #1#0*BASIC
PAGE=&1900
*FX21
CLOSE#0:CHAIN "RUBIK-L"
Rubik's Cube, by Robert Browning. These instructions are condensed from 'Quality Programs for the BBC' from Micro Press 1983.
*FX200,3
(d~A
27
<23;8202;0;0;0;
F
I=1 2
P)132,157,135,141:(3)"RUBIK'S CUBE";
Z&140: I=1 "By Robert Browning"
d
n*FX200,2
x!''" How to use the program."
'" The program first asks whether you have a colour monitor (or television). If you say you have, the subsequent display will be in colour, if not, it will be in black and white, with the"
m" colours represented by their initials. You can of course lie if you want to see the other effect."
" The cube will then be displayed, and you will be prompted 'Next _'. If you want the cube to twist at random, press RETURN. It will keep twisting (and showing the names of the moves it"
" makes) until you stop it by pressing any key. For any other response, you must be at least vaguely familiar with the terminology used for the cube."
'" ";:132,157,135
+"PRESS ANY KEY TO CONTINUE ";:156,30
*FX15,0
A$=:28,0,22,39,3:
" The cube's faces are labelled according not to colour but to their position relative to the user. The front face is that closest to the user, the back face is the most distant one; the left and"
ܽ" right faces are defined in the obvious way; and the remaining two faces are called up and down. The faces are referred to by their initial letters: F, B, L, R, U, and D."
" Any twist of any face has a 'sense' which is either clockwise or anti- clockwise. The sense of a twist is always given from the point of view of the face, not the point of view of the"
" user. If the left face is turned clock- wise, its top comes toward you; if the right face is turned clockwise, its top moves away from you."
A$=:
" If the front face is turned anticlock- wise, its top moves to your left; if the back face is turned anticlockwise, its top moves to your right."
" Now to the notation. A clockwise twist of a face is indicated simply by the name of the face: F, U, etc. If you like, you can follow it with the letter C to indicate clockwise."
" An anticlockwise twist of a face is indicated in several possible ways. The name of the face must of course be given; this can then be followed by A, ', or -1. (' is a shift character)."
"" A face can also be twisted through 180 degrees. This is equivalent to either two clockwise or two anticlockwise twists and is represented by the name of the face, followed by 2 or H."
,*FX15,0
6
A$=:
@" Apart from twisting faces, we must also be able to turn the whole cube. Rolling the cube so that the top comes toward you is turning it in the L (or R') sense; turning it so that the top"
J" always stays on the top, but turns clockwise, is turning it in the U (or D') sense. Such turns of the whole cube are indicated by the same notation as that for twisting faces, but preceded"
T)" by an asterisk _ *B, for example."
^" Moves can be entered one at a time, pressing RETURN after each. If you know what you're doing, though, then the program allows you to enter a complete sequence of moves (a 'process') before"
hu" pressing RETURN. Within one process, several moves after an asterisk are all taken to be whole-cube moves."
r*FX15,0
|A$=:28,0,23,39,3:
p" There must also be a way of reverting to single-face moves. This function is filled by the slash (/)."
G" Here are two example processes which you might care to try:"'
" LR'DU'BF'LR'"
/" *L/U2 D2 R2 U2 D2 R2 U2 L2 R2 U2 L2 *L"'
B" A process on one line can be typed with or without spaces."
" Finally, you might want to reset the cube to its starting position without solving it; this can be done by typing 'RESET'."
X" You might also want to restart the game; this can be done by typing 'BYE'.";
N" NOTE: The program will not accept lower case versions of any commands."
'" ";:132,157,135
("PRESS ANY KEY TO START ";:156,30
*FX15,0
A$=
*FX200,3
26,12
=&1900:"RUBIKS"
dc Rubik's Cube, by Robert Browning. This program is condensed from a full cube-solving program.
i>&E00P@}
n 2
xSETUP:CONTROL
*FX15,0
A=:
SETUP
A$
5 CUBE%(6,3,3),TEMP%(6,3,3),PX%(3,3,3),PY%(3,3,3)
VERTADJ=0.92
8CHARS$="FRUDLB/* ": MDS$="CHA 2' 2-": COLS$="RBYGWO"
%F$="0000324536416215126531464235"
%L$="0000341222223111331344443214"
4,5);"Rubik's Cube"
"0,10);"Do you have a colour"
*FX21,0
% 0,12)"monitor? " A$: A$=A$,1)
/ A$<>"Y" A$<>"N" '"Answer Yes or No."
A$="Y" A$="N"
23;8202;0;0;0;
"!CHARS0%=(A$="N"): HOLD0%=:
,CUBE(250,370,468)
6RESETCB
@
J
T CONTROL
^ S$
h28,0,31,19,22:
r
w*FX21,0
|23;8202;0;0;0;
'"Next - " S$
23,1,0;0;0;0;
I S$="BYE" S$="RESET" RESETCB: (S$)=-1 RAND EXEC(S$)
S$="BYE"
CUBE(MX%,MY%,HSIZE)
VSIZE,BLX,BLY
VSIZE=HSIZE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