8-Bit Software Online Conversion
:2.$.SevensM - Listing
10REM SEVENS v.1.19
20REM by M.Bobrowski 2'94
30:
40MODE 1
50PROCinit
60REPEAT:PROCreset
70PROCshuffle:PROCdeal:PROChand:go%=R
ND(2)-1
80REPEAT:IF go% H%=C%:PROCcomputer EL
SE H%=P%:PROCplayer
90IF N% PROCtable(N%):PROCdelete ELSE
IF N%=0 AND pointer%<53 PROCgetcard
100IF go%=0 PROChand ELSE COLOUR1:PRIN
TTAB(6,12);?C%;" "
110go%=(go%+1)MOD 2
120UNTIL ?C%=0 OR ?P%=0:PROCresults
130UNTIL end%
140MODE 131:END
150:
1000DEF PROCcomputer
1010SOUND1,-10,1,10:COLOUR0:PRINTTAB(0,
18)"My go: "'SPC98;
1020PROCsearch(1):COLOUR1:IF find% N%=S
%:M$=MID$(num$,(S%-1)MOD13+1,1)+MID$(sui
t$,(S%-1)DIV13+1,1):PRINTTAB(2,20)M$ ELS
E N%=0:M$="":PRINTTAB(0,20)"I can't"'" g
o"
1030COLOUR0:XX=INKEY(200)
1040PROCcheck
1050ENDPROC
1060:
1070DEF PROCplayer
1080REPEAT
1090COLOUR0:PRINTTAB(0,18)"Your go:"'SP
C98;:*FX15,1
1100FORI%=1TO3:SOUND1,-12,200,2:SOUND1,
0,0,1:NEXT:INPUTTAB(2,20)""M$:IF M$="" P
ROCsearch(0):IF find% UNTIL FALSE
1110IF M$>"" IF LENM$<>2 UNTIL FALSE
1120IF M$>"" IF INSTR(num$,LEFT$(M$,1))
=0 UNTIL FALSE
1130IF M$>"" IF INSTR(suit$,RIGHT$(M$,1
))=0 UNTIL FALSE
1140IF M$>"" N%=INSTR(num$,LEFT$(M$,1))
+13*(INSTR(suit$,RIGHT$(M$,1))-1) ELSE N
%=0
1150PROCcheck
1160UNTIL check% OR N%=0
1170ENDPROC
1180:
1190DEF PROCsearch(G%)
1200find%=FALSE:FORI%=1 TO ?H%:S%=H%?I%
1210FORJ%=0TO7:IF J%?T%=S%:find%=TRUE:J
%=7
1220NEXT:IF find% I%=?H%
1230NEXT:IF G%=0 AND M$="" AND find% CO
LOUR1:PRINTTAB(0,22)"You CAN"'" go!":VDU
7:XX=INKEY(200):COLOUR0
1240ENDPROC
1250:
1260DEF PROCcheck
1270check%=FALSE:IF M$="" ENDPROC
1280FORI%=1TO ?H%:IF H%?I%=N% check%=TR
UE
1290NEXT:IF check%=FALSE COLOUR1:PRINT'
"You have"'"not this"'"card !":VDU7:XX=I
NKEY(200):COLOUR0:ENDPROC
1300check%=FALSE
1310FORI%=0TO7:IF I%?T%=N% check%=TRUE:
J%=I%
1320NEXT:IF check%=FALSE COLOUR1:PRINT'
"You can'tuse this"'"card now.":VDU7:XX=
INKEY(200):COLOUR0:ENDPROC
1330IF J%MOD2 T%?J%=T%?J%+1 ELSE T%?J%=
T%?J%-1
1340IF N%MOD13=7 T%?(J%-1)=T%?(J%-1)-1
1350FORI%=0TO6STEP2:IF T%?I% MOD13=0 T%
?I%=0
1360NEXT:FORI%=1TO7STEP2:IF T%?I% MOD13
=1 T%?I%=0
1370NEXT
1380ENDPROC
1390:
1400DEF PROCgetcard
1410?H%=?H%+1
1420H%?(?H%)=A%?pointer%:pointer%=point
er%+1:COLOUR1:PRINTTAB(6,8);53-pointer%;
" ":COLOUR0
1430ENDPROC
1440:
1450DEF PROCdelete
1460FORI%=1TO ?H%:IF H%?I%=N% Q%=I%:I%=
?H%
1470NEXT:FORI%=Q%TO ?H%-1:H%?I%=H%?(I%+
1):NEXT
1480H%?(?H%)=0:?H%=?H%-1
1490ENDPROC
1500:
1510DEF PROCtable(N%):IF N%=0 ENDPROC
1520VDU24,8;292;952;1015;:SOUND0,-10,5,
2
1530row%=(N%-1)DIV13+1:col%=(N%-1)MOD13
+1:X%=col%*64-32:Y%=1160-row%*172:IF row
% MOD 2 K%=1 ELSE K%=0
1540GCOL0,0:IF col%<7 MOVEX%+60,Y%:PLOT
13,X%,Y%:PLOT45,X%,Y%-160:PLOT37,X%+60,Y
%-160 ELSE MOVE X%,Y%:PLOT45,X%+124,Y%:P
LOT45,X%+124,Y%-160:PLOT45,X%,Y%-160:PLO
T45,X%,Y%
1550GCOL0,3:MOVE X%+4,Y%-4:IF col%<7 MO
VEX%+60,Y%-4:PLOT85,X%+4,Y%-156:PLOT85,X
%+60,Y%-156 ELSE MOVEX%+120,Y%-4:PLOT85,
X%+4,Y%-156:PLOT85,X%+120,Y%-156
1560GCOL0,0:PLOT69,X%+4,Y%-156:PLOT69,X
%+4,Y%-4:IF col%>7 PLOT69,X%,Y%:PLOT69,X
%,Y%-160:GCOL0,3:PLOT69,X%,Y%-4:PLOT69,X
%,Y%-156
1570IF col%>6 GCOL0,0:PLOT69,X%+120,Y%-
4:PLOT69,X%+120,Y%-156 ELSE GCOL0,0:PLOT
69,X%+64,Y%:PLOT69,X%+64,Y%-160:GCOL0,3:
PLOT69,X%+64,Y%-4:PLOT69,X%+64,Y%-156
1580GCOL0,K%:VDU5:MOVE X%+8,Y%-12:PRINT
MID$(num$,col%,1)
1590MOVE X%+8,Y%-44:VDU223+row%
1600VDU4:ENDPROC
1610:
1620DEF PROChand
1630PROCsort(?P%):GCOL0,130:VDU24,8;8;9
52;280;16
1640IF ?P%<14:FOR I%=1 TO ?P%:X%=I%*64-
32:Y%=260:PROCdisplay:NEXT
1650IF ?P%>13:FOR I%=1 TO 13:X%=I%*64-3
2:Y%=260:PROCdisplay:NEXT:FOR I%=14 TO ?
P%:X%=(I%-13)*64-32:Y%=180:PROCdisplay:N
EXT
1660ENDPROC
1670:
1680DEF PROCdisplay
1690Z%=P%?I%:suit%=(Z%-1)DIV13+1:card%=
(Z%-1)MOD13+1:K%=suit% MOD 2
1700GCOL0,3:MOVEX%+4,Y%-4:MOVEX%+120,Y%
-4:PLOT85,X%+4,Y%-156:PLOT85,X%+120,Y%-1
56:GCOL0,0:MOVEX%,Y%:PLOT45,X%+124,Y%:PL
OT45,X%+124,Y%-160:PLOT45,X%,Y%-160:PLOT
45,X%,Y%
1710GCOL0,0:PLOT69,X%+4,Y%-156:PLOT69,X
%+4,Y%-4:IF I%=1 OR I%=14 GCOL0,2:PLOT69
,X%,Y%:PLOT69,X%,Y%-160 ELSE GCOL0,0:PLO
T69,X%,Y%:PLOT69,X%,Y%-160:GCOL0,3:PLOT6
9,X%,Y%-4:PLOT69,X%,Y%-156
1720GCOL0,0:PLOT69,X%+120,Y%-4:PLOT69,X
%+120,Y%-156:IF I%>13 GCOL0,3:PLOT69,X%+
124,Y%:GCOL0,0:PLOT69,X%,Y%
1730GCOL0,K%:VDU5:MOVE X%+8,Y%-12:PRINT
MID$(num$,card%,1)
1740MOVE X%+8,Y%-44:VDU(223+suit%)
1750VDU4:ENDPROC
1760:
1770DEF PROCshuffle
1780FOR I%=1 TO 52:A%?I%=I%:NEXT
1790FOR I%=1 TO 52:R%=RND(52):J%=A%?R%
1800A%?R%=A%?I%:A%?I%=J%:NEXT
1810ENDPROC
1820:
1830DEF PROCdeal
1840FORI%=1TO7:P%?I%=A%?I%:NEXT:?P%=7:P
ROCsort(7)
1850FORI%=1TO7:C%?I%=A%?(I%+7):NEXT:?C%
=7
1860pointer%=15:ENDPROC
1870:
1880DEF PROCsort(L%):IF L%=1 ENDPROC
1890LOCAL B%:FOR J%=1TOL%-1:Z%=J%
1900FOR I%=Z%+1 TO L%
1910IF H%?Z%>H%?I% Z%=I%
1920NEXT
1930B%=P%?J%:P%?J%=P%?Z%:P%?Z%=B%
1940NEXT:ENDPROC
1950:
1960DEF PROCinit
1970VDU19,2,2;0;:GCOL0,130:CLG:MOVE0,0:
DRAW960,0:DRAW960,1023:DRAW0,1023:DRAW0,
4:DRAW956,4:DRAW956,1019:DRAW4,1019:DRAW
4,4:MOVE0,288:DRAW956,288:MOVE956,284:DR
AW0,284:VDU28,31,31,39,1:COLOUR130:CLS
1980COLOUR1:PRINTTAB(1,0)"SCORE"''"You:
";:COLOUR0:PRINT"0":COLOUR1:PRINT"Comp
: ";:COLOUR0:PRINT"0"TAB(0,8)"Pack: "''"
Cards in"'" comp's"'"hand: "
1990VDU23,224,0,54,127,127,127,62,28,8,
23,225,0,8,28,62,127,127,28,62,23,226,0,
8,28,62,127,62,28,8,23,227,0,28,28,107,1
27,107,8,28
2000A%=&900:C%=&940:P%=&960:T%=&980:W%=
&938
2010num$="A23456789TJQK":suit$="HSDC":M
$="":!W%=0:dummy=RND(-TIME)
2020ENDPROC
2030:
2040DEF PROCreset
2050GCOL0,130:VDU24,8;292;952;1015;16,2
4,8;8;952;280;16:J%=7:FORI%=0TO7STEP2:T%
?I%=J%:T%?(I%+1)=J%:J%=J%+13:NEXT:COLOUR
1:PRINTTAB(6,8)"38"TAB(6,12)"7 "
2060ENDPROC
2070:
2080DEF PROCresults
2090V%=ABS(?P%-?C%)+2*(53-pointer%):COL
OUR1:IF ?P%=0 GCOL0,130:VDU24,8;8;952;28
0;16:?W%=?W%+V%:PRINTTAB(0,24)"You win"'
"by "; ELSE W%?1=W%?1+V%:PRINTTAB(0,24)"
I win by"
2100PRINT;V%;" pts":COLOUR0:PRINTTAB(6,
2);?W% TAB(6,3);W%?1:RESTORE:FORI%=1TO9:
READ p%,d%:SOUND1,-12,p%,d%:NEXT:SOUND1,
0,0,8:SOUND1,-15,128,4
2110PRINTTAB(0,27)"Again ?"''"(Y/N) ";:
end%=FALSE:REPEAT:G$=GET$:UNTILINSTR("Yy
Nn",G$):PRINTG$:IF INSTR("Nn",G$) end%=T
RUE
2120ENDPROC
2130DATA 128,12,124,4,120,12,116,4,108,
4,100,4,96,4,88,4,80,4