Blackjack v2 by Daniel Wedge *** MORE GAMES AND PROGRAMS FOR CASIO CALCULATORS AT *** ******** http://www.student.uwa.edu.au/~wedgey ********* INTRODUCTION ------------ Blackjack will run on a Casio FX-9700GH. It may work on other models - I haven't tried it. If you have any ideas, suggestions (for Blackjack and new games), bugs, then let me know! Symbols used in this document: = equal to != not equal to < less than <= less than or equal to > greater than >= greater than or equal to => then/and -> assign key @ display (triangle symbol) + add - subtract * multiply / divide pi the pi symbol t tera sign (T with funny ends) Notes: 1. Blackjack uses array memories and will lose all of your money if you run any program containing the Mcl command or the Defm command (if the Defm command is followed by a number less than ten.) So, in short, be prepared to lose your money each time you run another program. 2. I have heard that there is no Defm key on 9850 and upwards. Because the calculator has 28 memories by default (A,B..Z,r,theta) and i have written the program to show each card only once a hand, extra memory is required (one space for each card), hence the Defm. I will try to change this so that you can use other calculators. 3. The game is spread over two files because for some reason the code closest to the top of the file will run fastest. Hmmm.... 4. There is no 'split' feature in this game, because 1) there isn't enough screen space for 3+ hands 2) I couldn't be bothered trying. ok? 5. The calculator (bottom hand) has a very simple plan: get equal to or above your hand (top of screen) 6. Graphics: I originally had writing down the side of the screen, but it took up heaps of space (memory wise) so I got rid of it, and then I couldn't be bothered changing the graphics size to match the bigger screen, hence the small cards. I did try to resize the screen but some cards came out bigger than others and looked funny. You can do it if you want... change the Range 23,150... command to: Range 23,127,0,1,63,0 HINTS: 1. If you want to bet all your money, enter a negative number for your bet. The game will automatically bet all your money. 2. If you want to bet half your money, enter .5 for the bet. 3. You can change the initial amount of money but if you make it too high, it's less fun as the game can't cope with more than $1000000000000.00 (only that much?!) Actually it can but is comes out as 1.00E12 and I didn't like that. 4. You can bet zero if you suddenly get bad vibes about playing. 5. You can't bet more money than you have (but you can try!) 6. Use the quit command to quit, otherwise your numbers may come out rounded to 2dp. FILE 1 Size: 1569 bytes 'BLACKJACK Put this in any program Goto 0 Lbl G Defm 62 Int 4Ran# -> A Int 13Ran#+1 -> B 13A+B+10 -> E Z[E]!=0 => Goto G 1 -> Z[E] W=0 => B=1 => Isz I W!=0 => B=1 => Isz K Prog "BJ GRAFX" This is another file which contains Lbl H graphics, you may call it something B>10 => 10 -> B else as long as you are consistent W!=0 => Goto I C=11 => G=1 => B=10 => 21 -> B C=10 => G=1 => B=1 => 21 -> B C=1 => G=1 => B=10 => 21 -> B B=21 => Goto J G+1 -> G C+B -> C C>21 => "YOU BUST"@ C>21 => Goto 4 G=5 => "YOU HAVE FIVE CARDS"@ G=5 => Goto J C<21 => G>=2 => "SIT (0=NO 1=YES)"? -> W W!=0 => C<=11 => I>=1 => C+10 => C W!=0 => C<=11 => 1>=2 => C+10 => C C=21 => "YOU HAVE 21"@ C=21 => 1 -> W Goto G Lbl I H+1 -> H B=1 => D=10 => H=2 => 15 -> B B=10 => D=1 => H=2 => 15 -> B B=10 => B=11 => H=2 => 15 -> B B=15 => Goto J D+B -> D K>=1 => G!=0 => D+10>=C => D<=11 => D+10 -> D K>=1 => G!=0 => D+10>=C => D<=11 => Dsz K H=1 => 0 -> W W=0 => Goto G H=2 => D=21 => Goto I D>21 => "I BUST"@ D>21 => Goto J H=5 => "I HAVE FIVE CARDS"@ H=5 => Goto J D Goto G "I SIT"@ " " Plot 14,3:Plot 14,3:Line@ Goto J Lbl J B>=15 => "BLACKJACK!"@ D>21 => Z -> F C>D => Z -> F G=5 => G<=21 => 10Z -> F B=15 => 0 -> F B=21 => 20Z -> F D=21 => 0 -> F H=5 => D<=21 => 0 -> F C!=D => Goto 4 B=21 => Goto 4 "IT'S A PUSH"@ Cls 0 -> C~D 0 -> Z[10]~Z[62] 0 -> G~I 0 -> K Goto G Lbl 0 Defm 10 0 -> A~Z Range 23,150,0,1,63,0 " WELCOME TO" " BLACKJACK"@ 1000 -> X ;1000 is the starting money " " Z[5]>X => Goto 5 X -> Z[5] "YOUR ACCOUNT OPENED":"WITH":X@ Goto 1 Lbl 1 Cls 0 -> A~W 10 -> Y " " "BLACKJACK" "1. PLAY" "2. ACCOUNT" "3. QUIT"? -> M M=1 => Goto 2 M=2 => Goto 5 M=3 => Goto 9 Goto 1 Lbl 2 Int 2YRan# -> J J=0 => "JACKPOT!" J=0 => Isz L Goto 3 Lbl 3 "ENTER BET"? -> Z Z=.5 => .5Z[5] -> Z Z<0 => Z[5] -> Z Z>Z[5] => Goto 3 Z<.01 => Z!=0 => Goto 3 Z>=0 => Z[5]-Z -> Z[5] 1 -> W Goto G Lbl 4 Defm 10 J=0 => 10F -> F Z=0 => Goto 6 F=0 => "YOU LOST"@ F=0 => Goto 5 (Z[5]+F+Z) -> Z[5] Z[5]<=0 => 0 -> Z[5] Fix 2 "YOU WON:":F@ Goto 5 Lbl 5 Fix 2 F=-1 => "CARRIED OVER:" F!=-1 => "ACCOUNT BALANCE:" Z[5]@ Norm Z[5]>1t => -1 -> Z ;see symbols Z=-1 => 0 -> Z[5] Z=-1 => Goto 8 Z[5]=0 => Goto 7 Goto 1 Lbl 6 "YOU BET ZERO" " YOU LOSE ZERO" " YOU WIN ZERO!"@ " " " ALRIGHTY THEN!"@ " " Goto 5 Lbl 7 "YOU ARE BROKE."@ " " " BETTER LUCK" " NEXT TIME."@ Goto 9 Lbl 8 "I AM BROKE."@ " " " GO HOME YOU" " RICH BASTARD."@ Goto 9 Lbl 9 " ":" " " -----------" " :GAME OVER:" " -----------" " ":" " End of the file! Now... another one. Put this in the editor and call it "BJ GRAFX" (or whatever else you called it before) FILE 2 Size: 1098 bytes Lbl C 0 -> N~V W=0 => 21G+24 -> U W!=0 => 21H+24 -> U W=0 => 33 -> V W!=0 => 2 -> V H!=0 => Goto D ;'P' stands for Plot, 'L' for Line ;Do not press 'EXE' until told P21,31:P127,31:L:P23,1:P23,63:L:P44,1:P44,63:L:P65,1: P65,63:L:P86,1:P86,63:L:P107,1:P107,63:L:P127,1:P127,63:L (EXE) Goto D Lbl D A=0 => Goto E A=1 => Goto F A=2 => Goto G A=3 => Goto H Lbl E Plot U+8,V+1:Plot U+8,V+12:Line:Plot U+1,V+8:Line:Plot U+4, V+22:Line:Plot U+9,V+27:Line:Plot U+14,V+22:Line:Plot U+18, V+8:Line:Plot U+10,V+12:Line:Plot U+10,V+1:Line (EXE) Goto I Lbl F Plot U+10,V+1:Plot U+2,V+20:Line:Plot U+4,V+25:Line:Plot U+10, V+18:Line:Plot U+15,V+25:Line:Plot U+18,V+20:Line:Plot U+10, V+1:Line (EXE) Goto I Lbl G Plot U+8,V+1:Plot U+8,V+12:Line:Plot U+2,V+8:Line:Plot U+1, V+15:Line:Plot U+8,V+18:Line:Plot U+4,V+25:Line:Plot U+9, V+28:Line:Plot U+14,V+25:Line:Plot U+10,V+18:Line:Plot U+18, V+15:Line:Plot U+16,V+8:Line:Plot U+10,V+12:Line:Plot U+10, V+1:Line (EXE) Goto I Lbl H Plot U+9,V+1:Plot U+1,V+13:Line:Plot U+9,V+26:Line:Plot U+17, V+13:Line:Plot U+9,V+1:Line (EXE) Goto I Lbl I B!=2 => B!=13 => 1 -> N B!=5 => B!=6 => B!=13 => 1 -> O B!=4 => B!=11 => B!=13 => 1 -> P B!=2 => B!=3 => B!=7 => B!=11 => 1 -> Q B!=3 => B!=4 => B!=5 => B!=7 => B!=9 => 1 -> R B!=1 => B!=4 => B!=7 => B!=13 => 1 -> S B!=7 => B<10 => 1 -> T (no, it's not a mistake) B=12 => Plot U+18,V B=10 => Plot U+13,V+1 B=10 => Plot U+13,V+5 B=10 => Line B=13 => Plot U+17,V+1 B=13 => Plot U+15,V+3 B=13 => Line B=13 => Plot U+17,V+5 B=13 => Line N=1 => Plot U+17,V+1 N=1 => Plot U+17,V+3 Line O=1 => Plot U+17,V+3 O=1 => Plot U+17,V+5 Line P=1 => Plot U+17,V+5 P=1 => Plot U+15,V+5 Line Q=1 => Plot U+15,V+5 Q=1 => Plot U+15,V+3 Line R=1 => Plot U+15,V+3 R=1 => Plot U+15,V+1 Line S=1 => Plot U+15,V+1 S=1 => Plot U+17,V+1 Line T=1 => Plot U+15,V+3 T=1 => Plot U+17,V+3 Line G>=1 => Line@