Computer Science Canada a simple craps game that everyone should like

Author:  kit-kat-kid [ Wed May 05, 2004 7:45 am ]
Post subject:  a simple craps game that everyone should like

 code: var die1, die2, total : int var bet : real var pot : real var reply : string (1) pot := 100 randomize procedure rollagain     loop         randint (die1, 1, 6)         randint (die2, 1, 6)         if total = die1 + die2 then             put "you rolled a ", total             put "You win!!"             pot := pot + bet             put "You won ", bet, " dollars!! "             put "You now have ", pot, " dollars!! "             exit         elsif die1 + die2 = 7 then             put "you rolled a 7"             put "You loose!!"             pot := pot - bet             put "You lost ", bet, " dollars!!"             put "You now have ", pot, " dollars!!"             exit         else             put "you rolled a ", die1 + die2         end if     end loop end rollagain procedure start     loop         put "Do you want to roll? y or n " ..         get reply         exit when reply = "n"         exit when pot <= 0         put "You have ", pot, " dollars in your pot!!"         put "How much do you want to bet? " ..         get bet         cls         randint (die1, 1, 6)         randint (die2, 1, 6)         total := die1 + die2         put "You rolled ", die1 + die2         if die1 + die2 = 7 or die1 + die2 = 11 then             put "You win!!"             pot := pot + bet             put "You won ", bet, " dollars!! "             put "You now have ", pot, " dollars!! "         elsif                 die1 + die2 = 2 or die1 + die2 = 12 then             put "You loose!!"             pot := pot - bet             put "You lost ", bet, "  dollars!! "             put "You now have ", pot, " dollars!! "         else             rollagain         end if     end loop end start start if pot <= 0 then     put "GO AWAY YOU POOR BASTERED YOU DONT HAVE ANYMORE MONEY!!! " end if

 :