A Simple Slot Machine
The purpose of your programming assignment is for you to get a chance at
doing some good Object Oriented Programming, on a topic chosen by your instructor,
a topic that lends itself well to an OOP implementation.
You will implement, in C++, an application that simulates a simple slot machine with three reels.
DISCLAIMER: The purpose of this exercise is purely educational. Your instructor, the
Computer Science Department, IIT and its affiliates do not encourage you to play slot machines
or any other games of chance.
In a real slot machine the player pulls a handle to rotate the reels that have pictures printed on them. Winning or losing
is determined by which pictures line up with the pay line, a line in the middle of a viewing window. If each reel shows the
same winning picture along the pay line, then the player wins (certain single images are sometimes winners as well).
The payout (the amount the player wins) depends on what pictures fall along the pay line.
In your project, the reels will be labeled with numbers from 1 through 22. A user can place a bet for one or more of units
of currency (N), up to 10. The payout is 2*N in every case the same number falls along the pay line
in each wheel, EXCEPT for the following combinations where the payout is different:
1st Reel |
2nd Reel |
3rd Reel |
Payout |
2 |
2 |
2 |
3*N |
7 |
7 |
7 |
20*N |
7 |
7 |
any |
5*N |
13 |
13 |
13 |
4*N |
19 |
19 |
19 |
4*N |
Upon placing a bet, your slot machine will "spin the wheels", print the outcome, the payout and the
current player's balance.
Before the game begins the player will be prompted to enter the amount of currency (s)he has available
to play on the slot machine. The slot machine always starts with 1,000 unites of currency.
A sample interaction between the player and the machine is available below:
Information about how real slot machines work can be found at
HowStuffWorks.com as well as numerous other sites on the Internet.
Testing
To facilitate testing, the executable will accept an option --debug which will
tell the application to print the slot machine balance every time messages are printed.
What you'll turn in
- Project files, as follows:
- A .zip archive with all the source files needed to build the project. The name of the file will be
FirstnameLastName-source.zip
For example, if your name is Ann Student, then the name of your
source code archive file will be AnnStudent-source.zip
- an executable named FirstnameLastName.exe
The following environments are supported
- DOS: will run from the "cmd" windows
- cygwin: will run from the shell prompt
- Linux: will run from a bash or tcsh prompt (indicate your preference in the README file)
- a plain text README file, named FirstnameLastName-readme.txt,
indicating what the program does, how to build the executable, the platform it's been tested on,
and how to run it, plus any other information you consider useful - like the name of the author, etc.
- A one-pager memo addressed to your instructor; the file will be named
FirstnameLastName-memo.pdf Replace .pdf with .txt or .doc (MS-Word) as the only
acceptable alternatives to a PDF document. Include thoughts on the project,
how you approached it, any trouble spots you may have encountered, and suggestions you may have as to how
this project could be improved
- Create a .zip archive with the four files mentined above; the name of the file will be
FirstnameLastName.zip. This is the file that you are going to submit
for grading.
NOTE: We'd prefer that you use MS Visual C++ to write your code, as at times different compilers will act differently.
If you decide to use a different environment, such as cygwin or Linux, then please make sure your choice
is clearly stated in the README file.
When you'll turn it in
Projects are to be submitted by email to cs106project@gmail.com.
The deadline for submission is 11:59PM CST, Sunday December 5, 2004.
You can submit your work earlier if you want, please
see the grading rules for the edxtra credit you may earn. You may also submit late, however we don't encourage it
due to the heavy penalty you incur for late submission (see the grading rules for detail).
Grading
- A mark between 0 and 10 for functionality. The mark basically indicates
in what measure your program works properly and how well you have followed
the initial specification.
- A mark between 0 and 10 for readability. This mark will consider how well you used OOP principles
to design the application, how well documented your program is, and the general appearance of your final
report.
- Multiply the above two marks to get the mark for this programming assignment.
For each business day you turn in your project earlier you receive a 5%
bonus. However, penalties increase by 5% as well. You can turn in your assignment
up to ten business days ahead of the deadline.
Example:
- You turn in your assignment three days earlier: a 3*5=15% bonus will be
added to your assignment mark
- We find a single mistake in the functionality section and the penalty for
that mistake is 0.5 points. Since you have turned the assignment
three days earlier than the deadline, the penalty becomes
0.5*(1+3*5%)=0.5*(1+3*0.05)=0.575
- We calculate the mark by multiplying the marks for the
functionality and readability; in your case the mark for
functionality is 10-0.575=9.425, and the mark for readability is 10.
The result is 9.425*10=94.25
- We add the bonus to this mark: 94.25+94.25*15%=108.38 which we round
to 108. This is your final mark.
You may be asked to do a code review with your instructor.
Hints
- A fair amount of your grade will be based on your ability to write an Object Oriented program. Avoid
the temptation to write a procedural application. Take your time and think about the objects
that would best model the problem at hand.
- The spinning of the wheel will be simulated through the use of the srand and rand functions,
which are found in cstdlib.
- Be sure to update the player's account balance, as well as the machine's, at the end of the round.
- Scan all you files for viruses before you submit your project; penalties for submitting infected
files are quite heavy.
$Id: project.html,v 1.1 2004/10/28 00:23:42 virgil Exp $
|