Advertisement
akosiraff

Download Dirty Dice

Nov 13th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1.  
  2. Download: https://solutionzip.com/downloads/dirty-dice/
  3. Let’s play Dirty Dice
  4. The assignment’s objective is to create a C++ based game in which one player (the
  5. user) competes against the computer where each player tries to steal the points
  6. from the opponent. Each player starts out with 100 points. The game is won by the
  7. first player to reach a set number of points. The number of points required to win
  8. the game is to be inputted by the user. Each turn, the player (human or computer)
  9. repeatedly rolls a dice until either a 3 is rolled or the player chooses to hold. If
  10. player chooses to hold, the sum of the rolls (i.e. the turn total) is calculated. At any
  11. time during a player’s turn, the player is faced with a binary decision:
  12. 0. roll – If the player rolls a
  13. a. 3: the player steals 3 points from the opponent and it becomes the
  14. opponent’s turn.
  15. b. 1, 2, 4, 5, 6: the number is added to the player’s turn total and the
  16. player’s turn continues (i.e. gets to roll again).
  17. 1. hold – The turn total is calculated. The points are subtracted from the
  18. opponent’s score and added to the current player’s score. It becomes the
  19. opponent’s turn.
  20. Check whether a winner has been established at the end of every turn. The player
  21. who takes the first turn in the game is chosen randomly.
  22. Do NOT use: global variables, arrays, pass by reference functions, or pass by
  23. pointer functions.
  24. NOTE: if your C++ file does not compile with standard g++ compiler in Jupyter
  25. Hub you will get a zero on the C++ portion of the assignment (no partial
  26. credit). This will be the case with all C++ assignments going forward.
  27. Requirements:
  28. 1) Your program should contain the following three functions (besides the main
  29. function, of course):
  30. roll – takes in nothing. Returns a random int between 1 and 6.
  31. oneTurn – takes in a single boolean variable to indicate whether it’s user’s or
  32. computer’s turn (e.g. 1 = human turn, 0 = computer turn). Plays out the entire turn
  33. until player either rolls a 3 or chooses to hold. Returns the turn total as an integer
  34. value. (Note: this function should be calling the roll function). The computer player
  35. should:
  36. ? Roll until it reaches at least some minimum turn total
  37. ? Have some randomness in its decision making
  38. ? Be capable of rolling or holding past the minimum
  39. loopGame – takes in a single integer value for game points goal (i.e. the number of
  40. points player needs to reach to win the game). Continues to repeat until either
  41. computer player or human player has won. Returns a boolean value (1 = computer
  42. win, 0 = human win). (Note: this function should be calling the oneTurn function).
  43. 2) Your program should interactively display the player and the computer choices,
  44. the dice rolls, the running turn total and the running score after each turn.
  45. 3) You will need to use randomization for this assignment. Make sure you are
  46. seeding the randomizer so your program doesn’t end up generating the same
  47. pseudorandom sequence every time.
  48. 4) For interacting with the user, you must use cin and cout.
  49.  
  50. Download: https://solutionzip.com/downloads/dirty-dice/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement