I have spent the last few days making a Crazy 8's program in an attempt to code all the card games for calculators. I had no idea how BIG the project would get, until it neared completion. If you are in the mood to surmount a grand optimization objective, by all means, go right ahead and post your results in the comments:
Lbl 1
prgmCLEAR
ClrHome
ClrDraw
ClrList L₁
ClrList L₂
ClrList L₃
ClrList L₄
ClrList L₅
ClrList L₆
ClrList ⌊L7
ClrList ⌊L8
ClrList ⌊L9
ClrList ⌊L10
0→dim(⌊L7
0→dim(⌊L8
0→dim(⌊L9
0→dim(⌊L10
Lbl 2
"ACE 2 3 4 5 6 7 8 9 10 JACK QUEENKING "→Str1
"SPADES DIAMONDSHEARTS CLUBS "→Str2
Menu("CHOOSE GAME","POKER",P,"BLACKJACK",B,"CRAZY 8S",C
Lbl P
Disp "COMING SOON"
Pause
Stop
Lbl B
Disp "COMING SOON"
Pause
Stop
Lbl C
Output(2,10,"CRAZY"
Output(3,10,"CRAZY"
Output(4,12,"8S"
Output(6,7,"PRESS ANY KEY"
Repeat Ans
getKey→A
End
Lbl C1
DelVar ADelVar BDelVar CDelVar DDelVar EDelVar FDelVar GDelVar Z
0-1→M
0→N
For(A,1,4
randInt(0,12)→B
randInt(0,3)→C
B→L₁(1+dim(L₁
C→L₁(1+dim(L₁
End
dim(L₁)→D
For(A,1,4
randInt(0,12)→B
randInt(0,3)→C
B→L₃(1+dim(L₃
C→L₃(1+dim(L₃
dim(L₃)→E
End
For(A,1,4
randInt(0,12)→B
randInt(0,3)→C
B→L₄(1+dim(L₄
C→L₄(1+dim(L₄
End
dim(L₄)→F
DelVar ADelVar BDelVar CDelVar HDelVar θ
For(A,1,39
randInt(0,12)→B
randInt(0,3)→C
B→L₂(1+dim(L₂
C→L₂(1+dim(L₂
dim(L₂)→G
End
randInt(0,12)→K
randInt(0,3)→L
Lbl C2
ClrHome
DelVar A
Output(2,7,"OF
For(A,4,3+D/2)
Output(A,7,"OF
End
Output(1,1,"CARD TO MATCH:"
Output(2,1,sub(Str1,1+5K,5
Output(2,10,sub(Str2,1+8L,8
Output(3,1,"YOU HAVE:"
DelVar R
3→A
D-1→J
For(R,1,J,2)
A+1→A
L₁(R→B
Output(A,1,sub(Str1,1+5B,5
End
DelVar ADelVar H
3→A
For(H,2,D,2)
A+1→A
L₁(H→C
Output(A,10,sub(Str2,1+8C,8
End
Repeat Ans
getKey→A
End
Goto C3
Lbl C3
ClrHome
Output(1,1,"CARD MUST BE:"
Output(2,1,"AN EIGHT"
Output(3,1,"A"
Output(3,3,sub(Str2,1+8L,7
If K=0
Then
Output(4,1,"AN"
Output(4,4,sub(Str1,1+5K,5
Else
If K≠0
Then
Output(4,1,"A"
Output(4,3,sub(Str1,1+5K,5
Goto TT
End
Lbl TT
Repeat Ans
getKey→A
End
ClrHome
Output(1,1,"CARD TO MATCH:"
Output(2,1,sub(Str1,1+5K,5
Output(2,10,sub(Str2,1+8L,8
DelVar A
Output(2,7,"OF
For(A,4,3+D/2)
Output(A,11,"OF"
End
DelVar R
3→A
Output(3,1,"YOU HAVE:"
For(R,1,J,2)
A+1→A
L₁(R→B
Output(A,4,sub(Str1,1+5B,5
End
DelVar H
3→A
For(H,2,D,2)
A+1→A
L₁(H→C
Output(A,14,sub(Str2,1+8C,8
End
DelVar M
3→A
For(M,1,D/2)
A+1→A
Output(A,1,M
Output(A,2,":"
End
Output(10,1,"0: DRAW CARD"
DelVar A
Lbl C5
Repeat Ans
getKey→A
End
If A=102
Then
M+2→M
N+2→N
L₂(M→O
L₂(N→P
O→L₁(1+dim(L₁
P→L₁(1+dim(L₁
dim(L₁→D
Goto C7
Else
If A=92 or A=93 or A=94 or A=82 or A=83 or A=84
Then
Goto CC
Else
Goto C5
End
Lbl CC
If A=92
Then
Goto K1
Else
If A=93
Then
Goto K2
Else
If A=94
Then
Goto K3
Else
If A=82
Then
Goto K4
Else
If A=83
Then
Goto K5
Else
If A=84
Then
Goto K6
End
Lbl K1
L₁(1→B
L₁(2→C
If B=7
Then
7→K
B→L
DelVar A
seq(L₁(A),A,3,D)→L₅
Goto C6
Else
If B=K
Then
C→L
DelVar A
seq(L₁(A),A,3,D)→L₅
Goto C6
Else
If C=L
Then
B→K
DelVar A
seq(L₁(A),A,3,D)→L₅
Goto C6
End
Lbl K2
If 4>D
Then
Goto C5
Else
If 4<D
Then
Goto S2
End
Lbl S2
L₁(3→B
L₁(4→C
If B=7
Then
7→K
B→L
Goto T2
Else
If B=K
Then
C→L
Goto T2
Else
If C=L
Then
B→K
Goto T2
Else
If B≠7 and B≠K and C≠L
Goto C5
End
Lbl T2
If D<5
Then
DelVar A
DelVar B
augment(seq(L₁(A),A,1,2)→L₆
Goto C6
Else
If D>5
Then
DelVar A
DelVar B
augment(seq(L₁(A),A,1,2),seq(L₁(B),B,5,D)→L₆
Goto C6
End
Lbl K3
If 7>D
Then
Goto C5
Else
If 7<D
Then
Goto S3
End
Lbl S3
L₁(5→B
L₁(6→C
If B=7
Then
7→K
B→L
Goto T3
Else
If B=K
Then
C→L
Goto T3
Else
If C=L
Then
B→K
Goto T3
Else
If B≠7 and B≠K and C≠L
Goto C5
End
Lbl T3
If D<7
Then
DelVar A
DelVar B
augment(seq(L₁(A),A,1,4)→⌊L7
Goto C6
Else
If D>7
Then
DelVar A
DelVar B
augment(seq(L₁(A),A,1,4),seq(L₁(B),B,7,D)→⌊L7
Goto C6
End
Lbl K4
If 9>D
Then
Goto C5
Else
If 9<D
Goto S4
End
Lbl S4
L₁(7→B
L₁(8→C
If B=7
Then
7→K
B→L
Goto T4
Else
If B=K
Then
C→L
Goto T4
Else
If C=L
Then
B→K
Goto T4
Else
If B≠7 and B≠K and C≠L
Goto C5
End
Lbl T4
If D<9
Then
DelVar A
DelVar B
augment(seq(L₁(A),A,1,6)→⌊L8
Goto C6
Else
If D>9
Then
DelVar A
DelVar B
augment(seq(L₁(A),A,1,6),seq(L₁(B),B,9,D)→⌊L8
Goto C6
End
Lbl K5
If 8>D
Then
Goto C5
Else
Goto S5
End
Lbl S5
L₁(9→B
L₁(10→C
If B=7
Then
7→K
B→L
Goto T5
Else
If B=K
Then
C→L
Goto T5
Else
If C=L
Then
B→K
Goto T5
Else
If B≠7 and B≠K and C≠L
Goto C5
End
Lbl T5
If D<9
Then
DelVar A
DelVar B
augment(seq(L₁(A),A,1,8)→⌊L9
Goto C6
Else
If D>9
Then
DelVar A
DelVar B
augment(seq(L₁(A),A,1,8),seq(L₁(B),B,11,D)→⌊L9
Goto C6
End
Lbl K6
If 13>D
Then
Goto C5
Else
Goto S6
End
Lbl S6
L₁(11→B
L₁(12→C
If B=7
Then
7→K
B→L
Goto T6
Else
If B=K
Then
C→L
Goto T6
Else
If C=L
Then
B→K
Goto T6
Else
If B≠7 and B≠K and C≠L
Goto C5
End
Lbl T6
If D<11
Then
DelVar A
DelVar B
augment(seq(L₁(A),A,1,10)→⌊L10
Goto C6
Else
If D>11
Then
DelVar A
DelVar B
augment(seq(L₁(A),A,1,10),seq(L₁(B),B,13,D)→⌊L10
Goto C6
Lbl C6
If dim(L₅)>0
Then
ClrList L₁
DelVar A
For(A,1,dim(L₅)
L₅(A→B
B→L₁(1+dim(L₁
End
ClrList L₅
Goto C7
Else
If dim(L₆)>0
Then
ClrList L₁
DelVar A
For(A,1,dim(L₆)
L₆(A→B
B→L₁(1+dim(L₁
End
ClrList L₆
Goto C7
Else
If dim(⌊L7)>0
Then
ClrList L₁
DelVar A
For(A,1,dim(⌊L7)
⌊L7(A→B
B→L₁(1+dim(L₁
End
ClrList ⌊L7
Goto C7
Else
If dim(⌊L8)>0
Then
ClrList L₁
DelVar A
For(A,1,dim(⌊L8)
⌊L8(A→B
B→L₁(1+dim(L₁
End
ClrList ⌊L8
Goto C7
Else
If dim(⌊L9)>0
Then
ClrList L₁
DelVar A
For(A,1,dim(⌊L9)
⌊L9(A→B
B→L₁(1+dim(L₁
End
ClrList ⌊L9
Goto C7
Else
If dim(⌊L10)>0
Then
ClrList L₁
DelVar A
For(A,1,dim(⌊L10)
⌊L10(A→B
B→L₁(1+dim(L₁
End
ClrList ⌊L10
Goto C7
End
Lbl C7
If dim(L₁)=0
Then
Goto C8
Else
If dim(L₁)≠0
dim(L₁)→D
Goto C2
End
Lbl C8
Pause
Stop
EDIT: The program runs fine (considering you have good luck, which I don't). The excess lists are for AIs that will be added once the program is optimized. If I were to add the AIs now, the program would probably reach 6-7 KiloBytes! This would be too much to store, let alone run!