**TI89**mainProgram file 01/09/03, 20:48RblkjackZg() Prgm Local n1,n2,n3,n4,n5,d1,d2,d3,d4,d5,bet,smon,cards,cad,lp1,dcar,dscore,nscore,xy,yz,zt,d,o,mon Lbl re 200mon Goto rnd Lbl tb Toolbar Title "Hit",ht Title "Stand",st Title "Double Down",dd Title "Restart",re Title "Quit",qt EndTBar Goto tb Lbl rnd If mon0 Then Dialog Text string(mon) Text "Your out of money" EndDlog Text "God issues you 200 dollars" Goto re EndIf Dialog Text "Money: "&string(mon)&"" Request "Place a bet",bet EndDlog expr(bet)bet round(bet,0)bet 1cards If bet>100 Then Text "$100 is the max bet" Goto rnd EndIf If bet<1 Then Text "Minimum bet is $1" Goto rnd EndIf rand(13)n1 rand(13)n2 rand(13)n3 rand(13)n4 rand(13)n5 rand(13)d1 rand(13)d2 rand(13)d3 rand(13)d4 rand(13)d5 If d1>10 Then 10d1 EndIf If d2>10 Then 10d2 EndIf If d3>10 Then 10d3 EndIf If d4>10 Then 10d4 EndIf If d5>10 Then 10d5 EndIf If n1>10 Then 10n1 EndIf If n2>10 Then 10n2 EndIf If n3>10 Then 10n3 EndIf If n4>10 Then 10n4 EndIf If n5>10 Then 10n5 EndIf If d2=1 Then If d111 Then 11d2 EndIf EndIf If d1+d2>16 Then 2dcar Goto player EndIf If d1+d2<17 Then If d3=1 Then If d1+d2<11 Then 11d3 EndIf EndIf If d1+d2+d3>21 Then If d1=11 Then 1d1 EndIf If d2=11 Then 1d2 EndIf If d3=11 Then 1d3 EndIf EndIf 3dcar If d1+d2+d3>16 Then Goto player EndIf EndIf If d1+d2+d3<17 Then If d4=1 Then If d1+d2+d3<11 Then 11d4 EndIf EndIf If d1+d2+d3+d4>21 Then If d1=11 Then 1d1 EndIf If d2=11 Then 1d2 EndIf If d3=11 Then 1d3 EndIf If d4=11 Then 1d4 EndIf EndIf 4dcar If d1+d2+d3+d4>16 Then Goto player EndIf EndIf If d1+d2+d3+d4<17 Then If d5=1 Then If d1+d2+d3+d4<11 Then 11d5 EndIf EndIf If d1+d2+d3+d4+d5>21 Then If d1=11 Then 1d1 EndIf If d2=11 Then 1d2 EndIf If d3=11 Then 1d3 EndIf If d4=11 Then 1d4 EndIf If d5=11 Then 1d5 EndIf EndIf 5dcar Goto player EndIf Lbl player If n1=1 Then 11n1 EndIf If n2=1 Then If n111 Then 11n2 EndIf EndIf Lbl graph1 ZoomSqr ClrDraw ClrGraph setGraph("AXES","OFF") Line 25,0,26,0 Line 19,1,19,9 Line 13,1,13,9 Line 19,9,13,9 Line 19,1,13,1 Line 11,1,11,9 Line 5,1,5,9 Line 5,1,11,1 Line 5,9,11,9 Line 19,1,19,9 Line 13,1,13,9 Line 19,9,13,9 Line 19,1,13,1 Line 11,9,11,1 Line 5,9,5,1 Line 5,9,11,9 Line 5,1,11,1 PtText string(n1),17,6 PtText string(n2),9,6 PtText string(d1),17,4 PtText "P",15,2 PtText " ",18,2 PtText string(n1+n2),18,2 2cards n1+n2nscore If n1+n2>20 Then Goto st EndIf Goto tb Lbl ht If cards=2 Then If n1+n2+n3<12 Then If n3=1 Then 11n3 EndIf EndIf If n1+n2+n3>21 Then If n1=11 Then 1n1 EndIf If n2=11 Then 1n2 EndIf If n3=11 Then 1n3 EndIf EndIf If n1=1 Then PtText " ",17,6 PtText string(n1),17,6 EndIf If n2=1 Then PtText " ",9,6 PtText string(n2),9,6 EndIf Line 3,1,3,9 Line 3,1,3,9 Line 3,1,3,1 Line 3,9,3,9 PtText string(n3),1,6 PtText " ",18,2 PtText "P",15,2 PtText string(n1+n2+n3),18,2 n1+n2+n3nscore 3cards If n1+n2+n3>20 Then Goto st EndIf Goto tb EndIf If cards=3 Then If n1+n2+n3+n4<12 Then If n4=1 Then 11n4 EndIf EndIf If n1+n2+n3+n4>21 Then If n1=11 Then 1n1 EndIf If n2=11 Then 1n2 EndIf If n3=11 Then 1n3 EndIf If n4=11 Then 1n4 EndIf EndIf If n1=1 Then PtText " ",17,6 PtText string(n1),17,6 EndIf If n2=1 Then PtText " ",9,6 PtText string(n2),9,6 EndIf If n3=1 Then PtText " ",1,6 PtText string(n3),1,6 EndIf Line 5,1,5,9 Line 11,1,11,9 Line 11,9,5,9 Line 11,1,5,1 PtText string(n4),7,6 PtText " ",18,2 PtText "P",15,2 PtText string(n1+n2+n3+n4),18,2 n1+n2+n3+n4nscore 4cards If n1+n2+n3+n4>20 Then Goto st EndIf Goto tb EndIf If cards=4 Then If n1+n2+n3+n4+n5<12 Then If n5=1 Then 11n5 EndIf EndIf If n1+n2+n3+n4+n5>21 Then If n1=11 Then 1n1 EndIf If n2=11 Then 1n2 EndIf If n3=11 Then 1n3 EndIf If n4=11 Then 1n4 EndIf If n5=11 Then 1n5 EndIf EndIf If n1=1 Then PtText " ",17,6 PtText string(n1),17,6 EndIf If n2=1 Then PtText " ",9,6 PtText string(n2),9,6 EndIf If n3=1 Then PtText " ",1,6 PtText string(n3),1,6 EndIf If n4=1 Then PtText " ",7,6 PtText string(n4),7,6 EndIf Line 13,1,13,9 Line 19,1,19,9 Line 19,9,13,9 Line 19,1,13,1 PtText string(n5),15,6 PtText " ",18,2 PtText "P",15,2 PtText string(n1+n2+n3+n4+n5),18,2 n1+n2+n3+n4+n5nscore 5cards Goto st EndIf Lbl st If nscore>21 Then Goto end EndIf PtText string(d2),9,4 PtText "D",15,6 PtText string(d1+d2),18,6 If dcar=2 Then d1+d2dscore Goto end EndIf 0lp1 Loop lp1+.075lp1 If lp1>5 Then Goto el1 EndIf EndLoop Lbl el1 Line 3,1,3,9 Line 3,1,3,9 Line 3,1,3,1 Line 3,9,3,9 PtText string(d3),1,4 PtText "D",15,6 PtText string(d1+d2+d3),18,6 If dcar=3 Then d1+d2+d3dscore Goto end EndIf 0lp1 Loop lp1+.075lp1 If lp1>5 Then Goto el2 EndIf EndLoop Lbl el2 Line 5,1,5,9 Line 11,1,11,9 Line 11,9,5,9 Line 11,1,5,1 PtText string(d4),7,4 PtText "D",15,6 PtText string(d1+d2+d3+d4),18,6 If dcar=4 Then d1+d2+d3+d4dscore Goto end EndIf 0lp1 Loop lp1+.075lp1 If lp1>5 Then Goto el3 EndIf EndLoop Lbl el3 Line 13,1,13,9 Line 19,1,19,9 Line 19,9,13,9 Line 19,1,13,1 PtText string(d5),15,4 PtText "D",15,6 PtText string(d1+d2+d3+d5+d4),18,6 If dcar=5 Then d1+d2+d3+d4+d5dscore Goto end EndIf Lbl end 0lp1 Loop lp1+.075lp1 If lp1>5 Then Goto el4 EndIf EndLoop Lbl el4 If nscore=21 Then If n1+n2=21 Then Text "Blackjack" mon+1.5*betmon round(mon,0)mon Goto rnd EndIf EndIf If nscore>21 Then Text "You Bust" mon-betmon Goto rnd EndIf If dscore>21 Then Text "Dealer Busts" mon+betmon Goto rnd EndIf If dscore>nscore Then Text "You Lose" mon-betmon Goto rnd EndIf If nscore>dscore Then Text "You Win" mon+betmon Goto rnd EndIf If dscore=nscore Then Text "Push" Goto rnd EndIf Lbl dd If cards=2 Then If mon2*bet Then If n1+n2<11 Then If n3=1 Then 11n3 EndIf EndIf Line 3,1,3,9 Line 3,1,3,9 Line 3,1,3,1 Line 3,9,3,9 PtText string(n3),1,6 PtText " ",18,2 PtText string(n1+n2+n3),18,2 2*betbet n1+n2+n3nscore Goto st EndIf EndIf Lbl qt 0d 0xy 120yz 50zt For d,0,120 ClrIO xy+1xy yz-1yz zt-1zt Output zt+15,xy+5,"Black" Output 30,xy-25,"2002 by" Output xy-5,xy-19,"All rights" Output zt+15,yz+5,"jack" Output 30,yz-4,"Sandy Spicer" Output xy-5,yz+15,"reserved" If xy=45 Then Goto et EndIf For o,1,9 " "#("s"&char(48+o)) EndFor EndFor Lbl et EndPrgm