Cube-It

Developer(s): Ralph Hammer
Date: 1987
Type: Program
Platform(s): TS 2068
Tags: Game

A word-search game in the style of Boggle for one or more players with pen and paper. After a rhyming title screen with random AY tones, a menu offers instructions, the scoring table, a game, a back-up tape and quit. A game mixes 36 letters into a six-by-six grid in a thick border and starts a two-minute clock in minutes, seconds and tenths. Players write down words of two letters or more whose letters touch across, down or diagonally, without using a letter twice. When time is up the grid can be redrawn for checking alongside the points table (2 letters 1 point, then 2, 5, 10 and 25 points for six letters) and copied to a printer.

The REM credits Ralph Hammer and Time Designs Magazine, Mar/Apr 1987, and the title screen reads “By: Ralph Hammer, Las Vegas, Nev”. It is also covered in The Hacker of January 1990.

Program Analysis

Mixing the Letters

a$ holds the alphabet in order of English letter frequency, “ETAONRISHDLFCMUGYPWBVKXJQZ”. Lines 1310–1330 pick a position from 1 to 26 and keep it only half the time if it is past 9, and only a quarter of the time if it is past 19, so common letters turn up more often. Before mixing, line 370 calls RANDOMIZE and saves the resulting SEED from 23670–23671 in r. To redraw the grid for scoring, line 520 calls RANDOMIZE r and runs the same routine again, which produces the same letters.

Timer

Lines 400–430 nest loops for minutes, seconds and tenths. Each tenth waits until the low byte of FRAMES has moved on by more than five since the last tick, which is six frames, a tenth of a second at the TS2068’s 60 Hz. The clock is printed in place after each tenth, with a click each second and a two-note signal at the end.

Notable Techniques

  • 29 bytes of machine code, POKEd from DATA to 64737, copy the 768-byte character set to 64768, ORing each byte with itself shifted right one pixel, then point CHARS at the copy for a bold font. POKE 23607,60 switches back to the ROM font, and the program swaps between the two for headings and body text.
  • The title screen’s random tones stop early at a key press by setting the loop counter to 0, and PAUSE NOT x then either waits for a key or carries straight on.
  • Sound comes from SOUND writes to the AY registers, including a falling sweep and an envelope burst for the “SO LONG” exit.
  • The big “CUBE-IT” title combines block graphics with PLOT and DRAW strokes.
  • Menu option 4 saves the BASIC with LINE 20 and verifies it. The machine code is rebuilt from DATA at every run, so no code file is needed.

This program came from an Oliger (JLO SAFE) disk in the SNUG library set and was converted to load from tape. The program needed no changes; the tape copy autostarts at line 20. It was tested in ZEsarUX on a stock TS2068 through the title screen, the menu and a letter cube with the clock running.

Related Articles

Game based loosely on Boggle.

Image Gallery

Source Code

   10 REM >>  CUBE-IT  <<                 by Ralph Hammer        * Time Designs Mag. Mar/Apr 1987 
   20 CLEAR 64736: GO SUB 660: GO SUB 700
   30 LET a$="ETAONRISHDLFCMUGYPWBVKXJQZ": LET l$="________________________________"
   40 BORDER 5: BRIGHT 1: PAPER 5: INK 0: BRIGHT 0: CLS 
   50 PRINT '"   ::::::::","     ::::::"
   60 PRINT "   ::  ::","      ::"
   70 PRINT "   ::","      ::"
   80 PRINT "   ::","      ::"
   90 PRINT "   ::  ::","      ::"
  100 PRINT "   ::::::::","     ::::::"
  115 PLOT 66,120: DRAW 0,30: DRAW -2,0: DRAW 0,-30: DRAW 25,0: PLOT 83,150: DRAW 0,-30
  125 PLOT 98,120: DRAW 0,46: DRAW -2,0: DRAW 0,-46: DRAW 20,0: DRAW 0,30: DRAW -18,0: PLOT 114,120: DRAW 0,30
  130 PLOT 128,135: DRAW 18,0: DRAW 0,15: DRAW -20,0: DRAW 0,-30: DRAW 20,0: DRAW 0,5: PLOT 144,150: DRAW 0,-15: PLOT 128,150: DRAW 0,-30: PLOT 144,120: DRAW 0,5
  140 PLOT 208,166: DRAW 0,-46: DRAW 20,0: DRAW 0,5: PLOT 198,150: DRAW 22,0: PLOT 210,166: DRAW 0,-46: PLOT 226,120: DRAW 0,5
  150 PRINT '" A FUN-FOR-ALL WORD SEARCH GAME"
  160 PRINT "By: Ralph Hammer, Las Vegas, Nev";l$
  170 GO SUB 690: PRINT ''"GRAB A PEN, AND SOME PAPER, IT'STIME TO PLAY A WORD SEARCH CAPER"
  180 PRINT '"PLAY IT SOLO, EVEN TWO OR MORE. SEE WHO GETS THE FIRST HI SCORE."
  190 PRINT '"NOW DON'T BE SHY, OR VERY TARDY.PUSH A KEY FOR A SEARCHING PARTY"
  200 GO SUB 700: GO SUB 600
  210 PAUSE NOT x: BEEP .05,5
  220 BORDER 4: BRIGHT 1: PAPER 4: CLS 
  230 PRINT INK 7'TAB 10; PAPER 2;" CUBE-IT "
  240 INK 0: GO SUB 690: PRINT TAB 10; PAPER 6;" M E N U "
  250 PRINT AT 7,0;"SELECT 1-5:": GO SUB 700: PRINT '" 1. INSTRUCTIONS"''" 2. HOW TO SCORE ""CUBE-IT"""''" 3. PLAY GAME"''" 4. MAKE BACK-UP TAPE"''" 5. QUIT"
  260 PAUSE 0: LET i$=INKEY$: BEEP .05,5
  270 IF i$="1" THEN GO TO 710
  280 IF i$="2" THEN GO TO 950
  290 IF i$="3" THEN GO TO 330
  300 IF i$="4" THEN GO TO 1060
  310 IF i$="5" THEN GO TO 1090
  320 GO TO 260
  330 BORDER 6: BRIGHT 1: PAPER 6: CLS 
  340 GO SUB 1190: GO SUB 700
  350 PRINT AT 12,2;"::M::I::X::I::N::G::::L::E::T::T::E::R::S::"
  360 FOR i=1 TO 10: FOR j=0 TO 15: BEEP .003,j: NEXT j: NEXT i
  370 GO SUB 1190: RANDOMIZE : LET r=PEEK 23670+256*PEEK 23671
  380 GO SUB 1290: GO SUB 700
  390 BEEP .2,10: PAPER 2: INK 7: BRIGHT 1: PRINT AT 18,10,"    "
  400 LET y=PEEK 23672: FOR m=0 TO 1: FOR s=0 TO 59: FOR t=0 TO 9
  410 LET x=PEEK 23672: IF ABS (x-y)<=5 THEN GO TO 410
  420 LET y=x: PRINT AT 18,13;m;":";s;TAB 17;":";t: NEXT t: BEEP .005,1
  430 NEXT s: NEXT m: BEEP .3,10: BEEP .3,15
  440 PRINT AT 18,13;"2:00:0": BEEP .3,10: BEEP .3,15
  450 INK 0: PRINT AT 20,10; PAPER 7;" TIME IS UP "
  460 PAPER 6: PAUSE 120
  470 GO SUB 1190: PRINT AT 9,2;"<R> RE-DRAW CUBE FOR SCORING"
  480 PRINT '"  <C> COPY CUBE TO PRINTER"''"  <A> ANOTHER GAME"''"  <M> MAIN MENU": GO SUB 700
  490 PAUSE 0: LET i$=INKEY$: IF i$="c" THEN LET s=0: GO TO 520
  500 IF i$="a" THEN GO TO 330
  510 IF i$<>"r" THEN GO TO 220
  520 PAPER 4: GO SUB 1190: RANDOMIZE r: GO SUB 1290: GO SUB 1020: GO SUB 700: IF NOT s THEN COPY 
  530 PRINT #0;AT 1,0;"    <C>OPY  <P>LAY  <M>ENU": PAUSE 0: IF INKEY$="c" THEN COPY : GO TO 530
  540 IF INKEY$="p" THEN GO TO 330
  550 GO TO 220
  560 FOR d=0 TO 2: LET dd=d*2: PLOT 57+d,150-d: DRAW 142-dd,0: DRAW 0,-100+dd: DRAW -142+dd,0: DRAW 0,100-dd: NEXT d
  570 LET dd=68
  580 FOR d=80 TO 178 STEP 24: PLOT d,50: DRAW 0,99: PLOT 57,dd: DRAW 140,0: LET dd=dd+16: NEXT d
  590 RETURN 
  600 FOR x=0 TO 100
  610 LET f=INT (RND*256)
  620 SOUND 0,f;8,15;7,62
  630 PAUSE 10: IF INKEY$<>"" THEN LET x=0: GO TO 650
  640 NEXT x
  650 SOUND 7,63;8,0: RETURN 
  660 DATA 17,0,253,213,1,0,3,42,54,92,36,126,167,31,182,18,35,19,13,32,246,16,244,225,37,34,54,92,201
  670 FOR i=64737 TO 64765
  680 READ j: POKE i,j: NEXT i: RETURN 
  690 RANDOMIZE USR 64737: RETURN 
  700 POKE 23607,60: RETURN 
  710 BORDER 5: BRIGHT 1: PAPER 5: CLS 
  720 GO SUB 1190
  730 PRINT INK 0;TAB 9; PAPER 6;" INSTRUCTIONS "
  740 PRINT ''"AS YOU START THE GAME OF CUBE-ITA 6X6 LETTERED GRID WILL APPEAR."
  750 PRINT '"NEXT, A TWO (2) MINUTE TIMER    WILL START TICKING OFF ELAPSED  TIME."
  760 PRINT '"START LOOKING FOR TWO, THREE,   UP TO SIX (OR MORE) LETTER WORDSTHAT CAN BE FOUND WITHIN THE    GRID."
  770 PRINT '"WRITE DOWN ALL THE WORDS THAT   YOU CAN FIND WITHIN THE TWO     MINUTE TIME LIMIT."
  780 GO SUB 940
  790 PAUSE 0: CLS : GO SUB 690: BEEP .05,5
  800 PRINT '"WORDS CAN BE FOUND IN ANY DIREC-TION; HORIZONTALLY, VERTICALLY, AND DIAGONALLY."
  810 PRINT '"THEY CAN ALSO BE A COMBINATION  OF ALL THREE DIRECTIONS."
  820 PRINT '"WHEN FORMING A WORD, A LETTER   MUST TOUCH THE NEXT LETTER      EITHER AT THE LINE OR AT A      CORNER."
  830 PRINT '"DO NOT JUMP SQUARES TO FORM THE WORD.  DO NOT USE A LETTER TWICE"
  840 PRINT '"FOR EXAMPLE:"
  850 PRINT '"""ABY"" CANNOT BE USED TO SPELL   BABY."
  860 GO SUB 940
  870 PAUSE 0: CLS : GO SUB 690: BEEP .05,5
  880 PRINT '"""FOUND"" WORDS CAN NOT BE REUSED OR SCORED TWICE."
  890 PRINT '"IF TWO OR MORE PEOPLE ARE GOING TO PLAY, IT IS RECOMMENDED THAT THE FIRST PLAYER TO REACH 500   POINTS BE DECLARED THE WINNER."
  900 PRINT '"ALL WORDS, INCLUDING LEGAL NAMESAND ""SLANG"" WORDS ARE PERMITTED."
  910 PRINT '"ABBREVIATIONS AND FOREIGN WORDS ARE NOT ALLOWED."
  920 PRINT '"GOOD LUCK, AND HAVE FUN !!!"
  930 GO TO 1210
  940 GO SUB 700: PRINT '"   Press Any Key To Continue": RETURN 
  950 BORDER 5: PAPER 1: PAPER 5
  960 GO SUB 1190
  970 PRINT AT 1,19; INK 7; PAPER 2;" I T ";AT 2,9; INK 0; PAPER 6;" S C O R I N G "
  980 PRINT '" TO SCORE THE GAME OF ""CUBE-IT"""
  990 PRINT '"JUST COUNT THE NUMBER OF LETTERSIN EACH WORD."
 1000 PRINT '"POINT VALUES ARE DISTRIBUTED AS FOLLOWS:"''
 1010 GO SUB 1020: GO TO 1210
 1020 PRINT PAPER 6;" # OF LETTERS";TAB 20;"POINT VALUE "'
 1030 DATA 1,2,5,10,25
 1040 RESTORE 1020: FOR i=2 TO 6: READ j: PRINT TAB 4;i;TAB 14;"=";TAB 26-LEN STR$ j;j: NEXT i
 1050 RETURN 
 1060 BORDER 2: BRIGHT 1: PAPER 2: CLEAR 
 1070 SAVE "CUBE-IT" LINE 20: BEEP 2,25: PRINT INK 7;"Play tape; press a key to verify"
 1080 PAUSE 0: CLS : VERIFY "CUBE-IT": BEEP 2,25: RUN 
 1090 BORDER 1: BRIGHT 1: PAPER 5: CLS 
 1100 SOUND 7,62;8,15
 1110 FOR i=50 TO 100
 1120 SOUND 0,i: PAUSE 3
 1130 NEXT i
 1140 FOR d=1 TO 6: NEXT d
 1150 SOUND 6,6;7,7;8,16;9,16;10,16;12,56;13,8
 1160 PAUSE 90
 1170 SOUND 8,0;9,0;10,0
 1180 PRINT AT 11,11;" SO LONG ": STOP 
 1190 CLS : INK 7: PRINT 'TAB 9; PAPER 2;" C U B E  I T "
 1200 GO SUB 690: PLOT 142,164: DRAW 6,0: INK 0: RETURN 
 1210 PRINT AT 17,0;l$''"   MENU";
 1220 PRINT TAB 14;"PLAY";
 1230 PRINT TAB 25;"QUIT"'l$
 1240 GO SUB 700: PRINT TAB 7;"SELECT M, P, OR Q"
 1250 PAUSE 0: LET i$=INKEY$: BEEP .05,5: IF i$="m" THEN GO TO 220
 1260 IF i$="p" THEN GO TO 330
 1270 IF i$="q" THEN GO TO 1090
 1280 GO TO 1250
 1290 PRINT '': BORDER 2: LET i=USR 2217: FOR i=1 TO 6
 1300 PRINT TAB 8;: FOR j=1 TO 6
 1310 LET t=INT (RND*26+1): IF t>19 THEN IF INT (RND*2) THEN LET t=0
 1320 IF t>9 THEN IF INT (RND*2) THEN LET t=0
 1330 IF NOT t THEN GO TO 1310
 1340 PRINT a$(t);"  ";
 1350 NEXT j: PRINT '': NEXT i
 1360 GO SUB 560: RETURN

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.