→This assignment is due by Tuesday, September 15, 2026, 11:59 PM.←
→ As with all assignments, this must be an individual effort and cannot be pair programmed. Any debugging assistance must follow the course collaboration policy and be cited in the comment header block for the assignment.←
Jump To: · Rubric · Submission ·
The Game
Game Play
Mia is a dice game with bluffing. The game play goes as follows:
- Player A rolls two dice. While keeping the dice hidden, they can then decide to:
- Announce the actual value of the rolled dice
- Bluff and announce a value lower or higher than they actually rolled
- Player B then has two choices:
- Player B can call out Player A if they think they are bluffing. Player A reveals their dice. If their announcement matches the actual dice, then Player A gains a point. Otherwise if the dice don't match the announcement, then Player B gains a point.
- Player B can choose to roll a pair of dice. Upon rolling, Player B must announce a value equal to or higher than the value Player A announced.
- Play then continues with Player A choosing to either call out Player B, or announce a value that is equal to or higher than the previously announced value.
- The first player to 6 points wins!
Dice Values and Hierarchy
When the two dice are rolled, the value of the dice is formed by placing the higher die first and then the lower die.
Thus if a player rolls a 3 and a 5, then the value is 53. It is the samevalue if they roll a 5 and a 3.
The highest value is 21 and called Mia. Next in rank come all the doubles ordered by value, and lastly the remaining values are numerically ordered. The full value ordering from highest to lowest is:
- 21
- 66
- 55
- 44
- 33
- 22
- 11
- 65
- 64
- 63
- 62
- 61
- 54
- 53
- 52
- 51
- 43
- 42
- 41
- 32
- 31
Assignment Task
Your task is to create a human-vs-computer implementation of this game.
This assignment exercises your ability to use variables, conditionals, loops, and provides more experience with asking the computer to generate a pseudo-random number.
Step 1 - The Human's Roll
Begin by simulating the process of rolling two dice, formulate the corresponding value, and print this to the terminal for the user to see. Run your program to verify the expected values always print. Below are several examples.
You rolled: 53
You rolled: 44
You rolled: 32
Now, ask the user which value they wish to announce. Validate that they have entered an allowable value. If they give an invalid value, politely inform them and ask them to enter a new value.
You rolled: 53
What roll do you wish to announce?
> 78
Enter a valid roll.
What roll do you wish to announce?
> 25
Enter a valid roll.
What roll do you wish to announce?
> 52
At this time, we can assume that we have a semi-cooperative user and they will enter in a whole number. We do not need to test if they enter a letter or decimal value. We do need to test if they gave us an allowable value.
Step 2 - The Computer's Decision
We now need to force the computer to make a random decision of what to do: call or roll. The computer should decide to call the user out for bluffing 35% of the time.
Step 2A - The Computer Calls
If the computer calls, then check if the value the user announced is the same as the dice value rolled. If they are, then award the user a point and print a congratulatory message to the user. If they are different, then award a point to the computer and display an equivalent message.
You rolled: 21
What roll do you wish to announce?
> 21
You announce 21
The Computer calls you out!
You told the truth! You get a point!
You rolled: 31
What roll do you wish to announce?
> 32
You announce 32
The Computer calls you out!
You lied! The Computer gains a point.
At this point, the current round would end. Stay tuned for what comes next in Step 4!
Step 2B - The Computer Rolls
If the computer rolls, then two dice rolls need to be simulated for the computer and the corresponding value determined. The computer now needs to announce a value and has some additional choices:
- If the value they rolled is lower than the value the player announced, then they must bluff and announce a value that is equal to or higher than the player announced.
- If the value they rolled is equal to or higher than the value the player announced, then they may
- announce this actual value.
- bluff and announce a value that is equal to or higher than the player announced.
When presented with the option in Scenario 2.2, the computer should bluff 70% of the time.
You rolled: 54
What roll do you wish to announce?
> 54
You announce 54
Computer announces 63
Step 3 - The Human's Decision
The user now has the same two choices the computer had: call or roll. Prompt the user for what they would like to do.
They are able to enter C or c for call and R or r for roll. Any other
value ask them to reenter.
Do you wish to (C)all or (R)oll?
> t
Enter a valid choice
Do you wish to (C)all or (R)oll?
> 4
Enter a valid choice
Do you wish to (C)all or (R)oll?
> c
Do you wish to (C)all or (R)oll?
> R
Step 3A - The Human Calls
If the user calls, then check if the value the computer announced is the same as the dice value rolled. If they are, then award the computer a point and print a message to the user. If they are different, then award a point to the user and display an equivalent message.
Computer announces 21
Do you wish to (C)all or (R)oll?
> c
The Computer told the truth! The Computer gains a point.
Computer announces 21
Do you wish to (C)all or (R)oll?
> c
The Computer lied! You gain a point!
At this point, the current round would end. Stay tuned for what comes next in Step 4!
Step 3B - The Human Rolls
If the user decides to roll, then we are performing Step 1 again. The only difference from the first time through is the announced value must be equal to or higher than what the computer announced. Once the user has rolled, Step 2 is performed again. These two steps are continually repeated until somebody decides to call and end the round.
Step 4 - The Next Round
Since the user did the initial roll in Step 1, we'll now let the computer start the next round from Step 2.B. They do the initial roll and then decide any value to announce (remember they bluff 70% of the time). We're right back into Step 3 and we continue until somebody eventually decides to call.
After somebody calls, it's now the user's turn to begin the round. Rounds will continue until one player reaches six points and wins the game! See below for an example of a full game play:
Your Points: 0 Computer Points: 0
You rolled: 41
What roll do you wish to announce?
> 41
You announce 41
Computer announces 44
Do you wish to (C)all or (R)oll?
> c
The Computer told the truth! The Computer gains a point.
Your Points: 0 Computer Points: 1
Computer announces 31
Do you wish to (C)all or (R)oll?
> r
You rolled: 42
What roll do you wish to announce?
> 42
You announce 42
Computer announces 54
Do you wish to (C)all or (R)oll?
> r
You rolled: 11
What roll do you wish to announce?
> 11
You announce 11
The Computer calls you out!
You told the truth! You get a point!
Your Points: 1 Computer Points: 1
You rolled: 54
What roll do you wish to announce?
> 54
You announce 54
The Computer calls you out!
You told the truth! You get a point!
Your Points: 2 Computer Points: 1
Computer announces 53
Do you wish to (C)all or (R)oll?
> c
The Computer told the truth! The Computer gains a point.
Your Points: 2 Computer Points: 2
You rolled: 62
What roll do you wish to announce?
> 62
You announce 62
Computer announces 62
Do you wish to (C)all or (R)oll?
> r
You rolled: 32
What roll do you wish to announce?
> 22
You announce 22
Computer announces 21
Do you wish to (C)all or (R)oll?
> c
The Computer lied! You gain a point!
Your Points: 3 Computer Points: 2
Computer announces 53
Do you wish to (C)all or (R)oll?
> c
The Computer lied! You gain a point!
Your Points: 4 Computer Points: 2
You rolled: 54
What roll do you wish to announce?
> 54
You announce 54
Computer announces 63
Do you wish to (C)all or (R)oll?
> r
You rolled: 11
What roll do you wish to announce?
> 11
You announce 11
Computer announces 21
Do you wish to (C)all or (R)oll?
> c
The Computer told the truth! The Computer gains a point.
Your Points: 4 Computer Points: 3
Computer announces 65
Do you wish to (C)all or (R)oll?
> c
The Computer told the truth! The Computer gains a point.
Your Points: 4 Computer Points: 4
You rolled: 65
What roll do you wish to announce?
> 65
You announce 65
Computer announces 66
Do you wish to (C)all or (R)oll?
> c
The Computer lied! You gain a point!
Your Points: 5 Computer Points: 4
Computer announces 54
Do you wish to (C)all or (R)oll?
> r
You rolled: 21
What roll do you wish to announce?
> 21
You announce 21
The Computer calls you out!
You told the truth! You get a point!
You win!!!
Hints
It can be difficult to test programs involving random decisions. As a debugging tool during development you may want to consider the following:
- Hardcode in a
trueorfalseconditional value to force a particular decision branch to execute. This can verify that the outcome, when taken, behaves correctly. - Add additional output to display the computer's values and subsequent decisions, or use the debugger to trace the execution of the program. This can verify that a correct value was generated and the associated action taken.
Of course, be sure to undo any extraneous testing steps you put in place prior to submitting.
Grading Rubric
As this is an introductory C++ course that teaches the fundamental concepts of the language and implementation details of each algorithm, the use of the C++ algorithm library, lambda functions, structured bindings, and smart pointers are prohibited. The use of auto is also discouraged to be aware of the explicit type of every variable used throughout your program.
Your submission will be graded according to the following rubric:
| Points | Requirement Description |
| 0.5 | Submitted correctly by Tuesday, September 15, 2026, 11:59 PM |
| 0.5 | Project builds without errors nor warnings. |
| 2.0 | Best Practices and Style Guide followed. |
| 0.5 | Program follows specified user I/O flow. |
| 0.5 | Public and private tests successfully passed. |
| 2.0 | Fully meets specifications. |
| 6.00 | Total Points |
Submission
Always, always, ALWAYS update the header comments at the top of your main.cpp file. And if you ever get stuck, remember that there is LOTS of help available.
Zip together your main.cpp, Makefile files and name the zip file A1_USERNAME.zip where USERNAME is your user id. Upload this zip file to Canvas under A1.
After submitting to Canvas, download your submission to ensure your submission is correct and complete. Submissions that are empty or contain only the starter code will not be considered.
→This assignment is due by Tuesday, September 15, 2026, 11:59 PM.←
→ As with all assignments, this must be an individual effort and cannot be pair programmed. Any debugging assistance must follow the course collaboration policy and be cited in the comment header block for the assignment.←