Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. Question 3: Implement a game of dice
  2. We expect this question to take approximately 60-90 minutes.
  3.  
  4. You are being asked to design and implement a simple game of dice with two players—a human player and a computer controlled player. The rules are as follows:
  5.  
  6. 1. The game is divided into “rounds.” During each round, each player gets one “turn.”
  7. 2. On a turn the player rolls two six-sided dice.
  8. 3. The player wins the round that gets a double (or higher double if both get doubles). If neither player gets a double then the higher total wins. If they both have the same total then the player with the highest number on a die wins. If they both rolled the same numbers on their dice then the round is a draw and neither player gets a point.
  9. 4. On the next round the two players switch turns, i.e. the second one to roll becomes the first one to roll and vice versa.
  10. 5. The rounds continue until the human player decides to quit.
  11.  
  12. Now, before you go off and implement this game realize there is one catch, the computer player must have a winning average close to 70% but this game of “cheater’s dice” should still appear “almost” random and thus fair to the human player every time it’s played. So while the game may not follow the above list of rules exactly, it should appear to the player that it does. Provide a short description and then implement the game. You will not receive full credit without an explanation of how the computer cheats and why it still appears fair. Comment your code to explain all functionality. Important Note: Concentrate on core functionality. Do not worry about a user interface or other secondary or unrequested features.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement