CSCI 200 - Fall 2026
Foundational Programming Concepts & Design

A1 - Mamma Mia!

→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:

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:

  1. 21
  2. 66
  3. 55
  4. 44
  5. 33
  6. 22
  7. 11
  8. 65
  9. 64
  10. 63
  11. 62
  12. 61
  13. 54
  14. 53
  15. 52
  16. 51
  17. 43
  18. 42
  19. 41
  20. 32
  21. 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:

  1. 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.
  2. If the value they rolled is equal to or higher than the value the player announced, then they may
    1. announce this actual value.
    2. 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:

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:

PointsRequirement Description
0.5Submitted correctly by Tuesday, September 15, 2026, 11:59 PM
0.5Project builds without errors nor warnings.
2.0Best Practices and Style Guide followed.
0.5Program follows specified user I/O flow.
0.5Public and private tests successfully passed.
2.0Fully meets specifications.
6.00Total 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.←