twenty1 TI-83 Source Code - Skip Header

twenty1 TI-83 Source Code

This is intended to be the human readable version of the source code for Twenty-One - The Card Game. This version is intended to work only on the TI-83 Texas Instruments graphic calculator. Also available: Documentation about "Twenty-One - The Card Game" and versions of the program for other calculators and in other formats.

Any line that begins with a backslash is a comment and should not be entered into the calculator. (Comments have been colored green) For an authoritative copy of this program's source code that can be imported to the calculator via a computer, consult the text version of Twenty-One - The Card Game source code for the TI-83, along with the character reference. The special character reference also gives an overview of all non-ASCII characters for the calculator, and shows the menus in which they can be found.

\start83P\
\comment=Program file dated 04/10/96, 18:39
\protected=FALSE
\name=TWENTY1
0→H
0→I
Lbl 9
ClrHome
Disp "DEALING..."
ClrList L1
ClrList L2
52→dim(L1)
seq(int(A/4)(int(A/4)<10)+10(int(A/4)≥10),A,4,55,1)→L2
L2→L3
1→C
Lbl 1
iPart(randdim(L2))+1→D
L2(D)→L1(C)
L2(53-C)→L2(D)
dim(L2-1→dim(L2
IS>(C,52)
Goto 1
FnOff 
AxesOff
ZoomSto
ZStandard
ZInteger
1→A
Lbl 2
0→B
0→C
ClrDraw
Vertical 0
Text(0,1,"DEALER")
Text(0,49,"PLAYER")
B+L1(A)→B
B→D
L1(A)→K
Text(7,1,"?")
If L1(A)=1
11→D
A+1→A
If A=53
Then
Disp 
L3→L2
1→L
Lbl A
iPart(randdim(L2))+1→M
L2(M)→L1(L)
0→L2(M)
SortD(L2)
dim(L2-1→dim(L2
IS>(L,52)
Goto A
1→A
DispGraph
End
B+L1(A)→B
D+L1(A)→D
Text(14,1,L1(A))
If L1(A)=1 and B=D
B+10→D
A+1→A
If A=53
Then
Disp 
L3→L2
1→L
Lbl B
iPart(randdim(L2))+1→M
L2(M)→L1(L)
0→L2(M)
SortD(L2)
dim(L2-1→dim(L2
IS>(L,52)
Goto B
1→A
DispGraph
End
C+L1(A)→C
C→E
Text(7,49,L1(A))
If L1(A)=1
11→E
A+1→A
If A=53
Then
Disp 
L3→L2
1→L
Lbl C
iPart(randdim(L2))+1→M
L2(M)→L1(L)
0→L2(M)
SortD(L2)
dim(L2-1→dim(L2
IS>(L,52)
Goto C
1→A
DispGraph
End
C+L1(A)→C
E+L1(A)→E
Text(14,49,L1(A))
If L1(A)=1 and C=E
C+10→E
A+1→A
If A=53
Then
Disp 
L3→L2
1→L
Lbl D
iPart(randdim(L2))+1→M
L2(M)→L1(L)
0→L2(M)
SortD(L2)
dim(L2-1→dim(L2
IS>(L,52)
Goto D
1→A
DispGraph
End
If D=21 or E=21
Goto 7
14→G
Lbl 3
If G=35
Then
Text(50,49,"5-CARDS")
Text(57,49,"YOU WIN!"
1+I→I
Goto 8
End
Text(50,49,E,"- HIT?")
Text(57,49,"1=YES")
getKey
Lbl 4
getKey→F
If F=0
Goto 4
If F=92
Then
G+7→G
C+L1(A)→C
E+L1(A)→E
Text(G,49,L1(A))
If C≠E and C>11
C→E
If L1(A)=1 and E≤11
C+10→E
A+1→A
If A=53
Then
Disp 
L3→L2
1→L
Lbl E
iPart(randdim(L2))+1→M
L2(M)→L1(L)
0→L2(M)
SortD(L2)
dim(L2-1→dim(L2
IS>(L,52)
Goto E
1→A
DispGraph
End
If E<21
Goto 3
If E=21
Goto 7
Text(50,49,E,"- OVER 21 ")
Text(57,49,"YOU LOSE!"
H+1→H
Goto 8
End
14→G
49→J
Lbl 5
Text(50,J," ")
Text(57,J," ")
IS>(J,94)
Goto 5
Lbl 6
If G=35
Then
Text(50,1,"5-CARDS,"
Text(57,1,"WINNER"
H+1→H
Goto 8
End
If D<E
Then
G+7→G
B+L1(A)→B
D+L1(A)→D
Text(G,1,L1(A))
If B≠D and B>11
B→D
If L1(A)=1 and D≤11
B+10→D
A+1→A
If A=53
Then
Disp 
L3→L2
1→L
Lbl F
iPart(randdim(L2))+1→M
L2(M)→L1(L)
0→L2(M)
SortD(L2)
dim(L2-1→dim(L2
IS>(L,52)
Goto F
1→A
DispGraph
End
If D<21
Goto 6
End
Lbl 7
Text(50,1,"-----",D,"-----")
Text(50,49,"-----",E,"-----"
If D≥E and D≤21
Then
1→J
H+1→H
Else
49→J
I+1→I
End
Text(57,J,"WINNER")
Lbl 8
Text(7,1,K)
Pause 
Menu("PLAY","AGAIN",2,"AGAIN- SHUFFLE",9,"QUIT",0)
Lbl 0
ZoomRcl
AxesOn
ClrDraw
ClrList L1
ClrList L2
ClrList L3
ClrHome
Disp "DEALER WON:",H,"YOU WON:",I
Stop
COPYRIGHT STEPHEN OSTERMILLER 1996

\stop83P\