-
Notifications
You must be signed in to change notification settings - Fork 0
/
pontifex.bas
108 lines (108 loc) · 3.73 KB
/
pontifex.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
10 DIMD$(54):DIMTMP(54):POKE53280,1:POKE53281,1:PRINT""
100 D$(1)="Aa":D$(2)="2a":D$(3)="3a":D$(4)="4a":D$(5)="5a":D$(6)="6a"
110 D$(7)="7a":D$(8)="8a":D$(9)="9a":D$(10)="10a":D$(11)="Ja":D$(12)="Qa"
120 D$(13)="Ka"
130 D$(14)="Az":D$(15)="2z":D$(16)="3z":D$(17)="4z":D$(18)="5z"
140 D$(19)="6z":D$(20)="7z":D$(21)="8z":D$(22)="9z":D$(23)="10z"
150 D$(24)="Jz":D$(25)="Qz":D$(26)="Kz"
160 D$(27)="As":D$(28)="2s":D$(29)="3s":D$(30)="4s":D$(31)="5s"
170 D$(32)="6s":D$(33)="7s":D$(34)="8s":D$(35)="9s":D$(36)="10s"
180 D$(37)="Js":D$(38)="Qs":D$(39)="Ks"
190 D$(40)="Ax":D$(41)="2x":D$(42)="3x":D$(43)="4x":D$(44)="5x"
200 D$(45)="6x":D$(46)="7x":D$(47)="8x":D$(48)="9x":D$(49)="10x"
210 D$(50)="Jx":D$(51)="Qx":D$(52)="Kx":D$(53)="JA":D$(54)="JB"
300 DIMV(54)
310 REMFOR N=1TO54:V(N)=N:NEXTN:REM V(54)=53
350 REM **** READ IN DATA ****
360 FORN=1TO54:READC:V(N)=C:NEXTN
400 PRINT"az PONTIFEX FROM CRYPTONOMICON ON C64 sx":GOSUB2300
401 PRINT"DECK START:"
402 GOSUB 1600:GOSUB2300
405 GOSUB1500:GOSUB1600:GOSUB2300
410 GOSUB1700:GOSUB1600:GOSUB2300
420 PRINT"TRIPLE CUT...":GOSUB1800:GOSUB1900:GOSUB2000:GOSUB1600:GOSUB2300
430 PRINT"COUNT CUT...":GOSUB2100:GOSUB1600:GOSUB2300
440 PRINT"NEXT KEY...":GOSUB2200
500 REMPRINT: PRINT"AGAIN...":GOTO 400
510 REMFORX=0TO1000:NEXTX:GOTO400
600 PRINT"":END
1200 REM *** SHUFFLE
1210 FORJ=1TO53
1220 J%=J+INT(RND(1)*(55-J))
1230 TEMP=V(J):V(J)=V(J%):V(J%)=TEMP
1240 NEXTJ:RETURN
1300 REM *** MOVE B
1350 REM *** CUT 1
1400 REM *** CUT2
1500 REM *** FIND JA
1520 FOR J=1TO54:IFV(J)=53THENJA=J
1530 NEXTJ:PRINT"JA:"JA
1535 PRINT"MOVE A JOKER DOWN 1..."
1540 IFJA<54THENGOTO1560
1550 FORJ=53TO3STEP-1:V(J+1)=V(J):NEXTJ:V(2)=53:RETURN
1560 TEMP=V(JA+1):V(JA+1)=53:V(JA)=TEMP:JA=JA+1
1590 RETURN
1600 PRINT:PRINT : FORJ=1TO54:PRINTD$(V(J))" ";:NEXTJ:RETURN
1610 PRINT:PRINT : FORJ=1TO54:PRINTV(J);:PRINTD$(V(J));:NEXTJ:RETURN
1700 REM *** FIND JB
1720 FOR J=1TO54:IFV(J)=54THENJB=J
1730 NEXTJ:PRINT"JB:"JB
1735 PRINT"MOVE B JOKER DOWN 2..."
1740 IFJB<53THENGOTO1780
1750 IFJB=54THENGOTO1760
1755 IFJB=53THENGOTO1770
1760 REM DOWN TWO
1765 FORJ=53TO3STEP-1:V(J+1)=V(J):NEXTJ:V(3)=54:RETURN
1770 FORJ=52TO2STEP-1:V(J+1)=V(J):NEXTJ:V(2)=54:RETURN
1780 T=V(JB+1):TTWO=V(JB+2):V(JB+2)=54:V(JB)=T:V(JB+1)=TTWO:JB=JB+2
1790 RETURN
1800 REM CUT 1 AND 2
1810 REMFOR J=1TO54:IFV(J)=54THENJB=J:PRINT777
1820 REMFOR J=1TO54:IFV(J)=53THENJA=J
1830 REMPRINT: PRINT"JA:"JA"JB:"JB
1880 REMFOR J=1TO54:PRINTV(J);:NEXT
1890 RETURN
1900 REM**FIRST CUT
1910 IFJA>JBGOTO1960
1920 FORJ=JA-1TO1STEP-1:TMP(55-JA+J)=V(J):NEXTJ
1925 IF JB=54GOTO1940
1930 FORJ=JB+1TO54:TMP(J-JB)=V(J):NEXTJ
1940 FORJ=JATOJB:TMP(55-JB+J-JA)=V(J):NEXTJ
1958 REMPRINT:FORJ=1TO54:PRINTTMP(J);:NEXTJ
1959 RETURN
1960 REM DO JA AND JB BACKWARDS
1970 FORJ=JB-1TO1STEP-1:TMP(55-JB+J)=V(J):NEXTJ
1975 IF JA=54GOTO1990
1980 FORJ=JA+1TO54:TMP(J-JA)=V(J):NEXTJ
1990 FORJ=JBTOJA:TMP(55-JA+J-JB)=V(J):NEXTJ
1998 REMPRINT:FORJ=1TO54:PRINTTMP(J);:NEXTJ
1999 RETURN
2000 REM *** COPY TMP TO V
2010 FOR J=1TO54:V(J)=TMP(J):NEXTJ:RETURN
2100 REM** CUT COUNT CC IS COUNT CARD**
2110 CC=V(54):IF CC=54ORCC=53GOTO2180
2120 FORJ=1TOCC:TMP(53-CC+J)=V(J):NEXTJ:TMP(54)=V(54)
2130 FORJ=CC+1TO53:TMP(J-CC)=V(J):NEXTJ
2180 REM SKIP JOKERS ON BOTTOM
2190 RETURN
2200 GOSUB 2000
2210 PRINT"KEY IS:"V(1)
2220 RETURN
2300 GETA$:IFA$="" GOTO2300
2350 RETURN
5000 DATA 11,31,25,39,7,3,13,19,17,22,29
5010 DATA 51,26,54,2,42,44,27,41,4,33
5020 DATA 15,49,1,9,20,34,10,24,28,8,46
5030 DATA 16,23,38,43,48,52,30,12,14,50
5040 DATA 6,35,32,21,53,40,5,18,45,36
5050 DATA 37,47,10
9000 REM 1200 SHUFFLE
9010 REM 1500 MOVE A DOWN
9020 REM 1600 PRINT DECK
9030 REM 1700 MOVE B DOWN 2
9040 REM 1800 FIND A AND B SET TO JA/JB
9050 REM 1900 SWAP A AND B
9060 REM 2000 COPY TMP TO V
9070 REM 2100 PERFORM CUT COUNT
9075 REM 2200 PRINT KEY
9080 REM GOSUBS ARE AT 400