8-Bit Software Online Conversion
Eighteen. Game - Listing
10REM 8-TEEN (c) LDL Software dec'94
20ONERRORCLOSE#0:GOTO40
30DIMd%(5,5),s%(4),h%(5),v%(5),hs$(10
),hs%(10):PROCio(1)
40MODE1:PROCini:PROCscrn
50REPEAT
60IFok%THENPROCdice
70PROCkey:PROCmov
80IFok%THENPROCfld:PROCpnt
90IFb%=25ORk%=65THENPROCend
100UNTILout:MODE7
110*FX4,0
120*FX229,0
130END
140:
150DEFPROCdice:FORi%=1TO3:s%(i%)=s%(i%
+1):NEXT:s%(4)=RND(6):COLOUR1:COLOUR130:
FORi%=5TO3STEP-1:PROCplc(s%(i%-1),1,i%*5
):NEXT:dc%=s%(1):COLOUR3:COLOUR128:VDU31
,6,6,241:COLOUR3:COLOUR129:PROCplc(s%(1)
,1,5):ENDPROC
160:
170DEFPROCkey
180*FX21,0
190REPEAT:k%=(GETOR48)-48:IFk%=65THENP
ROCout
200UNTIL(k%<6ANDk%>0)ORk%=65:ENDPROC
210:
220DEFPROCmov:IFk%=65 ENDPROC
230ok%=0:FORve%=5TO1STEP-1:IFd%(k%,ve%
)=0THENd%(k%,ve%)=dc%:ok%=1:ve%=1
240NEXT:IFok%THENPROCplc(0,1,5):PROCpl
c(0,4,5)
250ENDPROC
260:
270DEFPROCfld:FORi%=1TO5:h%(i%)=0:v%(i
%)=0:NEXT:FORho%=1TO5:FORve%=1TO5:PROCpl
c(d%(ho%,ve%),ho%*5+5,ve%*5):h%(ve%)=h%(
ve%)+d%(ho%,ve%):v%(ho%)=v%(ho%)+d%(ho%,
ve%):NEXT,:PROCtot:ENDPROC
280:
290DEFPROCtot:COLOUR3:COLOUR129:PRINTT
AB(1,1)LEFT$("H: ",7-LEN(STR$(hs%(1)
)))STR$(hs%(1)):COLOUR0:COLOUR131:FORho%
=1TO5:VDU31,ho%*5+4,1:IFv%(ho%)<=18THENP
RINT" "LEFT$("00",2-LEN(STR$(v%(ho%))))S
TR$(v%(ho%))" "ELSEPRINT" -- "
300NEXT:COLOUR2:COLOUR129:PRINTTAB(34,
1)LEFT$(" ",5-LEN(STR$(sc%)))STR$(sc
%):COLOUR0:COLOUR131:FORve%=1TO5:VDU31,3
6,ve%*5+1:IFh%(ve%)<=18THENPRINT" "LEFT$
("00",2-LEN(STR$(h%(ve%))))STR$(h%(ve%))
" "ELSEPRINT" -- "
310NEXT:COLOUR3:COLOUR129:ENDPROC
320:
330DEFPROCpnt
340REPEAT:hp%=0:vp%=0:FORi%=1TO5
350IFh%(i%)=18THENhp%=i%
360IFv%(i%)=18THENvp%=i%
370NEXT
380IFhp%THENvp%=0:PROChor
390IFvp%THENPROCver
400IFhp%ORvp%THENPROCfld
410UNTILvp%=0ANDhp%=0
420PROCbon:IFb%=0THENPROCtot
430ENDPROC
440:
450DEFPROChor:FORho%=1TO5:COLOUR1:COLO
UR131:PROCplc(d%(ho%,hp%),ho%*5+5,hp%*5)
:FORi%=hp%TO1STEP-1:d%(ho%,i%)=d%(ho%,i%
-1):NEXT,:PROCtim(100)
460COLOUR0:COLOUR128:FORho%=1TO5:PROCp
lc(0,ho%*5+5,hp%*5):NEXT:COLOUR3:COLOUR1
29:sc%=sc%+(6-hp%)*5:ENDPROC
470:
480DEFPROCver:FORve%=1TO5:COLOUR1:COLO
UR131:PROCplc(d%(vp%,ve%),vp%*5+5,ve%*5)
:d%(vp%,ve%)=0:NEXT:COLOUR3:COLOUR129:PR
OCtim(100):sc%=sc%+5:ENDPROC
490:
500DEFPROCbon:b%=0:FORho%=1TO5:FORve%=
1TO5:IFd%(ho%,ve%)<>0THENb%=b%+1
510NEXT,:IFb%ANDb%<25THENENDPROC
520IFb%=25THENFORi%=1TO5:v%(i%)=20:h%(
i%)=20:NEXT:PROCtot:COLOUR0:COLOUR130:FO
Ri%=10TO12:PRINTTAB(10,i%);SPC(23);:NEXT
:PRINTTAB(11,11);"GAME OVER - PRESS KEY"
;:REPEATUNTILGET:ENDPROC
530COLOUR128:FORi%=1TO4:COLOUR2:PRINTT
AB(16,11)"BONUS = 100":PROCtim(70):COLOU
R0:PRINTTAB(16,11)"BONUS = 100":PROCtim(
30):NEXT:sc%=sc%+100:ENDPROC
540:
550DEFPROCplc(v%,x%,y%):o%=240:IFv%=0T
HENCOLOUR0:COLOUR128:VDU31,x%,y%,32,32,3
2,31,x%,y%+1,32,32,32,31,x%,y%+2,32,32,3
2:COLOUR3:COLOUR129
560IFv%=1THENVDU31,x%,y%,32,32,32,31,x
%,y%+1,32,o%,32,31,x%,y%+2,32,32,32
570IFv%=2THENVDU31,x%,y%,o%,32,32,31,x
%,y%+1,32,32,32,31,x%,y%+2,32,32,o%
580IFv%=3THENVDU31,x%,y%,o%,32,32,31,x
%,y%+1,32,o%,32,31,x%,y%+2,32,32,o%
590IFv%=4THENVDU31,x%,y%,o%,32,o%,31,x
%,y%+1,32,32,32,31,x%,y%+2,o%,32,o%
600IFv%=5THENVDU31,x%,y%,o%,32,o%,31,x
%,y%+1,32,o%,32,31,x%,y%+2,o%,32,o%
610IFv%=6THENVDU31,x%,y%,o%,32,o%,31,x
%,y%+1,o%,32,o%,31,x%,y%+2,o%,32,o%
620ENDPROC
630:
640DEFPROCtim(tm%):T%=TIME+tm%:REPEATU
NTILTIME>=T%:ENDPROC
650:
660DEFPROCout:COLOUR2:FORi%=10TO12:PRI
NTTAB(10,i%)SPC(23):NEXT:PRINTTAB(14,11)
"QUIT GAME Y/N ?":IFINSTR("YyJj",CHR$(G
ET))THENok%=0:ENDPROC
670COLOUR0:COLOUR128:FORi%=10TO12:PRIN
TTAB(10,i%)SPC(23):NEXT:COLOUR3:COLOUR12
9:FORho%=1TO5:PROCplc(d%(ho%,2),ho%*5+5,
10):NEXT:k%=0:ENDPROC
680:
690DEFPROCscrn
700COLOUR3:COLOUR129:CLG:FORi%=1TO4:s%
(i%)=RND(6):NEXT:FORi%=0TO2:PRINTTAB(0,i
%);SPC(40);:NEXT:FORi%=9TO30:PRINTTAB(6,
i%);" ";:NEXT:FORi%=3TO30:PRINTTAB(36,i%
);" ";:NEXT:FORho%=1TO5:h%(ho%)=0:FOR
ve%=1TO5:v%(ve%)=0:d%(ho%,ve%)=0
710NEXT,:COLOUR0:COLOUR131:FORho%=1TO5
:PRINTTAB(ho%*5+5,30)" ";STR$(ho%);" ";:
NEXT:COLOUR0:COLOUR131:VDU31,1,10,224,22
5,226,31,1,11,227,228,229,31,1,12,32,230
,32:COLOUR2:COLOUR129
720FORve%=1TO5:PRINTTAB(37+ve%DIV5,ve%
*5+3);STR$((6-ve%)*5);:NEXT:COLOUR3:ok%=
1:sc%=0:b%=1:q%=0:PROCtot:out=0:ENDPROC
730:
740DEFPROCini
750*FX4,2
760*FX229,1
770VDU23,224,0,0,0,0,0,0,1,3,23,225,0,
0,24,60,126,255,255,255,23,226,0,0,0,0,0
,0,128,192,23,227,7,15,31,63,0,0,0,0,23,
228,255,255,255,255,126,126,126,126,23,2
29,224,240,248,252,0,0,0,0,23,230,126,12
6,126,126,126,126,0,0
780VDU23,240,0,60,126,126,126,126,60,0
,23,241,8,12,14,255,255,14,12,8:COLOUR3:
COLOUR129:FORi%=1TO3:PRINTTAB(0,i%);SPC4
0;:NEXT:PRINTTAB(17,2)"8-TEEN":COLOUR2:C
OLOUR128:PRINTTAB(10,10)"A game to chall
enge!";TAB(15,15)"INFO Y/N?":COLOUR1
790COLOUR131:VDU23,1,0;0;0;0;:T=RND(-T
IME):FORi%=1TO3:PROCplc(6,i%*9,24):NEXT:
IF INSTR("YyJj",GET$)=0 ENDPROC
800CLS:COLOUR0:PRINTTAB(17,2)"8-TEEN":
PRINT'''" Play the game with the upper d
ice"'" (the other three are on stock)"'"
by pressing 1, 2, 3, 4 or 5 in order"'"
to fill the rows or columns until you"'
" reach a total of 18 points."'''" By";
810PRINT" filling a row (=18) you earn
the"'" yellow scores printed at the rig
ht"'" hand of the screen."''" By filling
a column (=18) you earn"'" a score of 5
points."'''" Whenever you clear the fie
ld, a BONUS of 100 pts. is added to";
820PRINT" your score."''''" MAKE EIGH
TEEN WITH 3,4 OR 5 DICE!!":PRINT''TAB(8)
"During the game: Q=QUIT":REPEATUNTILGET
:ENDPROC
830:
840DEFPROCend
850COLOUR2:COLOUR128:CLS:PRINTTAB(12,3
)"HIGH SCORES ARE:":FORi%=1TO10:PRINTTAB
(4,i%+7);hs$(i%);LEFT$(STRING$(25," "),2
5-LEN(hs$(i%)));LEFT$(" ",6-LEN(ST
R$(hs%(i%))));STR$(hs%(i%));:NEXT:IFsc%>
hs%(10)THENPROCinv:GOTO850
860IFq%THENPRINTTAB(4,20)"Do you want
to save score Y/N ?":IFINSTR("YyJj",CHR
$(GET))THENPROCio(0)
870PRINTTAB(4,23)"Do you want to play
again Y/N ?":IFINSTR("Nn",CHR$(GET))THE
Nout=1:ENDPROC ELSEPROCscrn:ENDPROC
880:
890DEFPROCinv:PRINTTAB(4,20)"Enter you
r name for the TOP TEN":VDU31,4,22,241,3
2,23,1,1;0;0;0;:COLOUR0:COLOUR130:PRINTS
PC(27):VDU31,7,22:min%=7:max%=min%+25:pl
%=min%:n$="":REPEAT
900i%=GET:IFi%=13OR(i%=127ANDpl%=min%)
OR(i%<>127ANDpl%=max%)THEN920
910VDU31,pl%,22,i%:pl%=pl%+1:n$=n$+CHR
$(i%):IFi%=127THENpl%=pl%-2:n$=LEFT$(n$,
pl%-min%)
920UNTILi%=13:FORi%=1TO10:IFsc%>=hs%(i
%)THENFORj%=10TOi%+1STEP-1:hs$(j%)=hs$(j
%-1):hs%(j%)=hs%(j%-1):NEXT:hs$(i%)=n$:h
s%(i%)=sc%:q%=1:sc%=0:i%=10
930NEXT:VDU23,1,0;0;0;0;:ENDPROC
940:
950DEFPROCio(fl%):IFfl%THENFORi%=1TO10
:hs$(i%)="JJ":hs%(i%)=110-i%*10:NEXT:f%=
OPENIN"8TNDAT":FORi%=1TO10:INPUT#f%,hs$(
i%),hs%(i%):NEXT:CLOSE#0:ENDPROC ELSEf%=
OPENOUT"8TNDAT":FORi%=1TO10:PRINT#f%,hs$
(i%),hs%(i%):NEXT:CLOSE#0:ENDPROC