→This assignment is due by Thursday, September 11, 2025, 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 ·
Assignment Code Starter
Make sure you have the appropriate comment header block at the top of every assignment from this point forward. The header block should include the following information at a minimum.
/* CSCI 200: Assignment 1: A1 - Slot-o-mania!
*
* Author: XXXX (INSERT_NAME)
* Resources used (Office Hours, Tutoring, Other Students, etc & in what capacity):
* // list here any outside assistance you used/received while following the
* // CS@Mines Collaboration Policy and the Mines Academic Code of Honor
*
* XXXXXXXX (MORE_COMPLETE_DESCRIPTION_HERE)
*/
// The include section adds extra definitions from the C++ standard library.
#include <iostream> // For cin, cout, etc.
// We will (most of the time) use the standard library namespace in our programs.
using namespace std;
// Define any constants below this comment.
// Must have a function named "main", which is the starting point of a C++ program.
int main() {
/******** INSERT YOUR CODE BELOW HERE ********/
cout << "Hello world!" << endl; // print Hello world! to the screen
/******** INSERT YOUR CODE ABOVE HERE ********/
return 0; // signals the operating system that our program ended OK.
}
Slot Machine
Your goal for this assignment is to create a slot machine that the user can place wagers on the outcome. The wheels will be configurable for how many numbers they can hold. Your program will validate the user input and ensure all rules are properly followed.
Configure the Wheels
The first step is to configure the machine. Begin by asking the user what the minimum and maximum values should be. At this point, your program should look as follows:
What is the minimum wheel value? 1
What is the maximum wheel value? 10
We will assume (for the moment) we have a smart user that will follow instructions and enter the expected inputs. That is, the maximum will be larger than the minimum.
Spin The Wheels
The next step is to properly set up a Mersenne Twister and uniform distributions that correspond to a slot wheel. The distribution range will correspond to the values the user entered.
Generate three random numbers and print their values to simulate the slot spinning. Your program should now look as follows:
What is the minimum wheel value? 1
What is the maximum wheel value? 10
Result: 9 5 1
Did We Win?
- If all three wheels produce the same value, then print out
JACKPOT!
. - If any two wheels produce the same value, then print out
Winner
. - If no wheels match, then print out
Better luck next time
.
Three possible outcomes could now be:
Result: 9 5 1
Better luck next time
Result: 9 5 5
Winner
Result: 1 1 1
JACKPOT!
Roll Again?
After the user sees their outcome, prompt the user to either roll again or cash out. If they choose to roll again, generate three new values and tell the user the outcome. Continue this process until the user decides to cash out.
What is the minimum wheel value? 1
What is the maximum wheel value? 10
Result: 9 5 1
Better luck next time
What do you wish to do?
R - roll again
C - cash out
R
Result: 3 3 5
Winner
What do you wish to do?
R - roll again
C - cash out
C
Have a nice day!
Raise the Stakes
The user will now start with a bank of $100. Before rolling, they can choose how much they wish to wager. If they hit a jackpot, then they will win 10 times their bet. If they are a winner, then they will win 3 times their bet. Otherwise, they lose their money.
The user can now keep playing until they choose to cash out or they run out of money.
What is the minimum wheel value? 1
What is the maximum wheel value? 10
You have $100, how much do you wish to wager? 10
Result: 9 5 1
Better luck next time
You now have $90
What do you wish to do?
R - roll again
C - cash out
R
You have $90, how much do you wish to wager? 10
Result: 4 5 4
Winner
You now have $110
What do you wish to do?
R - roll again
C - cash out
R
You have $110, how much do you wish to wager? 10
Result: 5 5 5
JACKPOT!
You now have $200
What do you wish to do?
R - roll again
C - cash out
C
Have a nice day!
Validation Time
We are still assuming a smart user (if we ask for an integer, they'll give us an integer. If we ask for a character, they'll give us a character). But we are now going to ensure the user can't cheat at our game and don't break it.
Minimum Wheel Complexity
Ensure the maximum is at least 9 more than the minimum. Continue prompting the user until this condition is met.
What is the minimum wheel value? 1
What is the maximum wheel value? 1
What is the maximum wheel value? 9
What is the maximum wheel value? 0
What is the maximum wheel value? -1
What is the maximum wheel value? 10
You have $100, how much do you wish to wager?
The House Always Wins
Ensure the user wagers a positive amount that is not greater than their current bank.
You have $90, how much do you wish to wager? 1000
You have $90, how much do you wish to wager? -100
You have $90, how much do you wish to wager? 0
You have $90, how much do you wish to wager? 10
Result: 1 2 3
Play Again, If You Can
As long as the user has money to play again, then ask them if they want to play again. Otherwise, tell them it's time to go.
You have $100, how much do you wish to wager? 100
Result: 6 9 1
Better luck next time
You now have $0
Time for you to go
To give some flexibility to the user, allow them to enter an uppercase or lowercase letter when they are choosing what to do.
You have $100, how much do you wish to wager? 5
Result: 7 1 7
Winner!
You now have $110
What do you wish to do?
R - roll again
C - cash out
r
You have $110, how much do you wish to wager? 5
Result: 6 1 8
Better luck next time
You now have $105
What do you wish to do?
R - roll again
C - cash out
R
You have $105, how much do you wish to wager? 5
Result: 5 4 1
Better luck next time
You now have $100
What do you wish to do?
R - roll again
C - cash out
c
Have a nice day!
You now have a fully working slot machine! How much can you win?
Complete the Technical Build Process
Now that the program is working, be sure you have set up the build process correctly and have created a
Makefile
to use with the build. When you build
your program, you need to be using a Makefile
and make
to compile and link
your code. See the Submission section of the needed files to properly submit the
assignment.
> make
g++ -std=c++17 -o main.o -c main.cpp
g++ -o A1 main.o
> ./A1
What is the minimum wheel value?
Extra Credit Extensions
Implement any of the following extensions:
-
Allow the user to choose 3, 4, or 5 wheels to spin. Payouts are now as follows:
- Any two match: bet*1 (win your money back)
- Any three match: bet*3
- Any four match: bet*10
- All five match: bet*100
Result: 4 8 8 2 Winner!!
Result: 7 1 7 7 7 Big Winner!!
-
Display the line above and the line below the wheel result. The output will now look as below (with numbers
replacing the letters):
When the user bets, ask them how many lines they wish to play. They can choose to play 1 to 5 lines at a time. They must have enough bank to cover their bet on each line. After rolling, check the following lines for a win condition:Result: A B C D E F G H I
- Line 1: D E F
- Line 2: A B C
- Line 3: G H I
- Line 4: A E I
- Line 5: G E C
Grading Rubric
Your submission will be graded according to the following rubric:
Points | Requirement Description |
0.5 | Submitted correctly by Thursday, September 11, 2025, 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 |
Extra Credit Points | Requirement Description |
+0.5 | +0.5 for each extension fully & correctly implemented |
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
. Upload this zip file to Canvas under A1.
→This assignment is due by Thursday, September 11, 2025, 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.←