1) Your program should contain the following three functions (besides the main function, of course):

roll - takes in nothing. Returns a random int between 1 and 6.

oneTurn - takes in a single boolean variable to indicate whether its users or computers turn (e.g. 1 = human turn, 0 = computer turn). Plays out the entire turn until player either rolls a 3 or chooses to hold. Returns the turn total as an integer value. (Note: this function should be calling the roll function).

The computer player should:

  • Roll until it reaches at least some minimum turn total
  • Have some randomness in its decision making
  • Be capable of rolling or holding past the minimum

loopGame - takes in a single integer value for game points goal (i.e. the number of points player needs to reach to win the game). Continues to repeat until either computer player or human player has won. Returns a boolean value (1 = computer win, 0 = human win). (Note: this function should be calling the oneTurn function).

2) Your program should interactively display the player and the computer choices, the dice rolls, the running turn total and the running score after each turn.

3) You will need to use randomization for this assignment. Make sure you are seeding the randomizer so your program doesnt end up generating the same pseudorandom sequence every time.

4) For interacting with the user, you must use cin and cout.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.