Guest User

Untitled

a guest
Aug 10th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. crapsMain()
  2. inputBalance()
  3. inputBetAmount()
  4. display gamesPlayed, balance, bet
  5. WHILE bet <> 0 DO
  6. Display comeOutRollMessage
  7. rollDice()
  8. IF diceTotal = 7 Or diceTotal = 11 THEN
  9. winGame = true
  10. ELSE
  11. IF diceTotal = 2 OR diceTotal = 3 OR diceTotal = 12 THEN
  12. winGame = false
  13. ELSE
  14. diceTotal = point
  15. Display inactiveMessage, point
  16. rollDice()
  17. WHILE diceTotal <> point AND diceTotal <> 7 DO
  18. rollDice()
  19. ENDWHILE
  20. IF diceTotal = point THEN
  21. winGame = true
  22. ELSE
  23. winGame = false
  24. ENDIF
  25. ENDIF
  26. ENDIF
  27. endOfGame()
  28. inputBetAmount()
  29. ENDWHILE
  30. leaveGame()
  31. STOP
  32. -----------------------------------------------------------------------
  33. endOfGame()
  34. IF wingame = true
  35. amountWon = bet * 2
  36. balance = balance + amountWon
  37. display winGame, amountWon, balance
  38. ELSE
  39. display winGame, bet, balance
  40. ENDIF
  41. EXIT
  42. -----------------------------------------------------------------------
  43. inputBalance()
  44. input initialBalance
  45. WHILE initialBalance <= 0 DO
  46. display error
  47. input initialBalance
  48. ENDWHILE
  49. balance = initialBalance
  50. gamesPlayed = 0
  51. EXIT
  52. -----------------------------------------------------------------------
  53. inputBetAmount()
  54. input bet
  55. WHILE bet > balance OR bet < 0 DO
  56. display error
  57. input bet
  58. ENDWHILE
  59. IF bet <> 0
  60. gamesPlayed = gamesPlayed + 1
  61. ENDIF
  62. EXIT
  63. -----------------------------------------------------------------------
  64. leaveGame()
  65. display gamesPlayed
  66. IF balance > initialBalance
  67. winnings = balance - initalBalance
  68. display winnings
  69. ELSE
  70. losses = initialBalance - balance
  71. display initalBalance, balance
  72. EXIT
  73. -----------------------------------------------------------------------
  74. rollDice()
  75. IF isDieRollInput = True THEN
  76. Input die1, die2
  77. ELSE
  78. die1 = randomInteger(1 - 6)
  79. die2 = randomInteger(1 - 6)
  80. ENDIF
  81. diceTotal = die1 + die2
  82. display die1, die2, diceTotal
  83. EXIT
Add Comment
Please, Sign In to add comment