9

Score


The idea of Score is that every number from 1 to 10 must be scored, once and once only. The computer rolls two dice, and you decide how you want them scoring. For example, if the sum of the two dice is 8, you could score 8 alone, or 7 and 1, or 5 and 3, or 5, 2 and 1 . . . but you get the idea. The twin snags are that you must make up the dice-roll total, and that you cannot score any number twice. The result is an extraordinarily difficult game to win.
   After the instructions, lines 100 to 130 draw ten score boxes and clear the array. Lines 180 to 200 draw two pretty boxes in which appear the dice rolls, and line 240 restricts communication texts to the lower portion of the screen. The fearsome line numbered 320 ensures that the chosen number - if legal - appears in the appropriate array box, so that at all times the user has the array before him and can see which numbers have not yet been scored. You are prevented from cheating, but the program is not intelligent enough to know when the player is in a 'no-win' situation. It is up to the user to recognise this and type '99' to concede the game. The screen will then clear and another game is started automatically.

Variables

A(10)The array 1-10, each element of which has to be scored
Y%Counter for box rows
X%Box number in the row
XGeneral counter
D1First dice roll
D2Second dice roll
DICESum of dice rolls as yet unscored
PPlayer's input
FLAGIf =1, an unscored array element found
X$Title text
C%Title text colour
L%Length of box
H%Height of box
F%Box input flag
S%Sound counter

   10 MODE7:PROCTITLE("SCORE")
   20 PRINT'''"In this game, you have to 'score' all"
   30 PRINT"numbers from 1 to 10. Two dice are used"
   40 PRINT"& if the roll is (eg) 8, you can score"
   50 PRINT"2 and 6, or 3 and 5, or 1, 2 and 5."
   60 PRINT'"You may not score any number twice, and"
   70 PRINT"you must always make up the total of"
   80 PRINT"the dice roll.":PROCRET
   90 DIM A(10)
  100 MODE7:FOR Y%=1 TO 2:FOR X%=0 TO 4
  110 PROCbox(X%*7,Y%*4,2,1,148,1)
  120 NEXT:NEXT
  130 FORX=1 TO 10:A(X)=0:NEXT
  140  
  150 REM - Game loop
  160  
  170 PRINTTAB(0,12);"Dice roll - "
  180 PROCbox(14,12,2,1,149,1)
  190 PROCbox(21,12,2,1,149,1)
  200 D1=RND(6):D2=RND(6)
  210 PRINTTAB(16,12);CHR$135;D1
  220 PRINTTAB(23,12);CHR$135;D2
  230 DICE=D1+D2
  240 VDU28,0,24,39,15
  250 CLS:PRINT"Which number(s) to score? Press RETURN"
  260 PRINT"after each. Type 99 to quit."
  270 INPUT P:IF P=99 GOTO100 ELSE IF P>10 GOTO250
  280 IF A(P)=0 GOTO300
  290 VDU7:PRINT"That number has been scored.":PROCRET:GOTO270
  300 IF DICE-P>=0 GOTO320 ELSE VDU7
  310 PRINT"That number is too big.":PROCRET:GOTO270
  320 VDU26:PRINTTAB((P-1)MOD5*7+2,((P-1)DIV5+1)*4);CHR$135;P
  330 VDU28,0,24,39,15
  340 A(P)=P:DICE=DICE-P
  350 IF DICE>0 CLS:PRINT"Next";:GOTO270
  360  
  370 REM - Check for win
  380  
  390 FLAG=0:FOR X=1 TO 10:IF A(X)=0 FLAG=1
  400 NEXT:CLS:IF FLAG=1 GOTO 420
  410 PROCDBL(5,15,131,"YOU WIN!"):PROCWARBLE:END
  420 PRINT"For next dice throw -":PROCRET:VDU26:GOTO170
  425  
  430 DEFPROCTITLE(X$)
  440 PRINTCHR$132;;STRING$(19,"Oo")
  450 PROCDBL((36-LEN(X$))/2,4,131,X$)
  460 PRINT''CHR$132;;STRING$(19,"Oo")
  465 ENDPROC
  466  
  470 DEFPROCDBL(X%,Y%,C%,X$)
  480 PRINTTAB(X%,Y%);CHR$141;CHR$C%;X$
  490 PRINTTAB(X%,Y%+1);CHR$141;CHR$C%;X$:ENDPROC
  500  
  510 DEFPROCbox(X%,Y%,L%,H%,C%,F%)
  520 LOCALV%,W%,I%,J%
  530 PRINTTAB(X%,Y%);
  540 V%=VPOS:W%=POS:PRINTTAB(W%,V%-H%);CHR$C%;"7";
  550 FORI%=0TOL%+1:PRINT"£";:NEXT:PRINT"k"
  560 PRINTTAB(W%,V%+1);CHR$C%;"u";
  570 FORI%=0TOL%+1:PRINT"p";:NEXT:PRINT"z"
  580 FORJ%=V%-H%+1TOV%:PRINTTAB(W%,J%);CHR$C%;"5":NEXT
  590 FORJ%=V%-H%+1TOV%:PRINTTAB(W%+L%+3,J%);CHR$C%;"j"
  600 NEXT:IF F%GOTO680
  610 PRINTTAB(W%+2,V%);"";
  620 FORI%=1TOL%:PRINT".";:NEXT
  630 PRINTTAB(W%+3,V%);:X$=""
  640 G$=GET$:IF ASCG$=13 GOTO680
  650 IF ASCG$<>127 PRINT;G$;:X$=X$+G$:GOTO640
  660 IF X$="" GOTO 640
  670 X$=LEFT$(X$,1):PRINTCHR$8;".";CHR$8:GOTO640
  680 ENDPROC
  690  
  700 DEFPROCRET
  710 PRINTTAB(5,22);"PressRETURN  ";:G$=GET$
  720 ENDPROC
  730  
  740 DEFPROCWARBLE
  750 FORS%=1TO20:SOUND1,-12,30,1
  760 SOUND1,-12,100,1:NEXT:ENDPROC