TITLE : Risky Business AUTHOR: Roy F A Maclean, r.f.a.maclean@hw.ac.uk http://www.cee.hw.ac.uk/~mthrfam/calc/casio/index.html DATE: 11th Sept 1996 MAKE: CASIO MODEL: fx7700G or greater SIZE: 487 NOTES: In the program below the letter 'O' never appears. If it looks like one it will in fact be the number '0' zero. The listing is padded out for readability. __________________________________________ ~ on the alpha menu <= less than or equal to >= greater than or equal to / division -> assignment => implication <> not equals _ display Ran# random number (on the math/prb menu) __________________________________________ You are Tom Cruise from the film 'Risky Business'. You come back home to find that your house belongings have been stolen ( 13 items: total worth $9100). The guy that has stolen them agrees to auction them back to you. You've only got $91 on you, so he says: "Okay I'll pretend I've only got $91 also." "We'll each make a bid for each item, and whoever bids highest gets the item. If we bid the same than it rolls over into the next item." You must try to get back as much as possible. At the end the worth of the things you have got back will be displayed. Try to get back all $9100. Be careful not too bid everything at the start or you won't get very much back. The calculator plays the part of the thief. It makes a bid, then asks you for a bid. It then tells you what its bid was so you can tell who got that item. If you try to bid more than the balance of what you've got left then a message will be displayed "BAL ONLY" 35 for example. Good Luck! __________________________________________ Lbl 0: Mcl Int (2Ran#)+1->r 3Ran#+1->M 91->A~B Lbl 1 Int (13Ran#+1)->C M[C]=0=>Goto 9 13->F:Lbl 8 M[F]=0=>F->C M[F]=0=>Goto 9 Dsz F:Goto 8 Lbl 9 0->E:A=0=>Goto A B=0=>Goto 2 0->K:13->F:Lbl 4 M[F]=0=>K+F->K Dsz F:Goto 4 0->L:0->F:Lbl 5 M[F]=0=>L+F->L L>=K/2=>Goto 6 Isz F:Goto 5 Lbl 6 r=1=>Int (ARan#/(13-D))+1->E r=2=>C+Int CRan#->E C+J>=F=>Int (Ran#Int M(C+J))->E E>B=>B+1->E E>A=>A->E D=12=>A->E Lbl A 1->M[C] "ITEM WORTH":100C_ 0->G:Lbl 3 G>B=>"BAL ONLY" G>B=>B_ "YOUR BID"?->G G>B=>Goto 3 Frac G<>0=>Goto 3 G<0=>Goto 3 "CALC BID":E_ A-E->A:B-G->B E>G=>H+C+J->H G>E=>I+C+J->I E=G=>J+C->J E<>G=>0->J Isz D:D<13=>Goto 1 Lbl 2 9->A:Lbl B " ":Dsz A:Goto B "YOUR END TOTAL" 100I_ "NEW GAME"_ Goto 0 __________________________________________ -- Roy Maclean Maths Dept. r.f.a.maclean@hw.ac.uk Heriot-Watt University http://www.cee.hw.ac.uk/~mthrfam Edinburgh