UMBC CS 201, Spring 02
 UMBC CMSC 201 Spring '02 CSEE | 201 | 201 S'02 | lectures | news | help

 CMSC 201 Programming Project Three 201's Modified KENO Out: Monday 4/1/02 Due: Before Midnight Sunday 4/14/02 The design document for this project, design3.txt, is due: Before Midnight, Sunday 4/07/02

## The Objective

The objective of this assignment is for you to practice good design techniques (top-down design that has appropriate use of functions that minimize coupling and maximize cohesion) and to become familiar with using two-dimensional arrays and structures.

## The Background

The State of Maryland has a gambling game called KENO. In this project, you will simulate playing KENO, but with slightly easier rules.

For each game of KENO, 20 numbers are chosen randomly from the range of values 1 to 80 and displayed in a grid on a screen. Four rows and five columns are used to display the 20 values. No duplication of numbers are allowed in these values.

In order to play KENO, the player fills out a slip. On the slip s/he must first decide whether s/he wants to try to match only 1 of the 20 numbers, or 2, or more. The number of matches you are trying to make is called the spot. So if the player wants to bet that he can match 4 of the 20 numbers, it is said that he's playing a 4 spot game. The player can choose to play a 1 spot game up to a 10 spot game.

Next the player must decide how much to wager. He can choose to bet \$ 1, \$ 2, \$ 3, \$ 4, \$5, \$ 10, or \$ 20 per game. The chart shown below will show the prize value per dollar wagered.

Next the player must choose the numbers he thinks will come up. Obviously, if the player is playing a 3 spot game, he must enter 3 numbers; a 7 spot game, 7 numbers, etc. You must do error checking on the user's input so that s/he does not give duplicate numbers or numbers that are not in the range of 1 to 80, inclusive. In the real KENO game, if you are playing the 3 (or more) spot game, you can win smaller prizes than those shown in the chart below for matching fewer number than the spot of the game. In our modified version, the player must match all 3 numbers to win a 3 spot game. The payouts are shown in the chart below.

#### KENO Payout Chart

1 spot game match 1 to win \$ 2 per \$ 1 bet 2 spot game match 2 to win \$ 10 per \$ 1 bet 3 spot game match 3 to win \$ 25 per \$ 1 bet 4 spot game match 4 to win \$ 50 per \$ 1 bet 5 spot game match 5 to win \$ 300 per \$ 1 bet 6 spot game match 6 to win \$ 1000 per \$ 1 bet 7 spot game match 7 to win \$ 2500 per \$ 1 bet 8 spot game match 8 to win \$ 10000 per \$ 1 bet 9 spot game match 9 to win \$ 25000 per \$ 1 bet 10 spot game match 10 to win \$ 100000 per \$ 1 bet Finally, the player must choose how many consecutive Keno games he wants to play using those numbers. S/he may chose 1, 2, 3, 4, 5, 10 or 20 consecutive games.

The real KENO also gives the user the option of playing a bonus, but our version won't deal with bonuses.

You are to write a program that simulates the playing of KENO, using the CMSC 201 modifications stated above. These modifications will make the coding of the project easier.

You must use a structure to hold the information found on a slip.
Here is the structure definition you are required to use :

typedef struct slip { int spots; int wager; int picks[10]; int games; } SLIP; You must use a two-dimensional array of 4 rows and 5 columns to hold the numbers that are drawn for a single game. Remember no duplicates are allowed.

Your program must calculate the cost of a slip and ask the user for that much money as well as determine whether the customer is a winner and calculate how much his winnings are.

The user can continue to play as long as s/he wants. After each group of consecutive games the user is given the choice to quit or continue playing. To quit the user must enter -1. To continue the user can enter any other integer.

To make grading easier, you must get the seed for the random number generator from the user rather than getting the seed with a call to time. The random number generator should be seeded only one time at the very beginning of your program (Not within any loop). The user's response to the prompt "Please enter any positive integer to begin playing" is to be used as the seed to the random number generator.

Since we are using the same machine with the same operating system, if you use the same seed as I did in the sample run, 7, then the numbers produced by the random number generator will be identical to the ones I got. Use the modulus technique to modify those values to be within the range of 1 to 80, inclusive. When I get a number which is a duplicate, I don't use it and immediately get another random number to use instead. You must use this method to produce your sets of twenty numbers per game so that your program's output will match mine exactly

You will keep track of the total number of games played, the total winnings, and whether the player has broken even, is ahead by how much, or is in the hole by how much. These totals should be shown to the user just before asking if s/he wants to play again.

You are to use separate compilation for this project. You may have as many .c and .h files as you feel are necessary. Group your functions according to their use into appropriately named files.

### My Guarantee

I guarantee that all of the input used by the graders will be integers.

## Submitting the Program

To submit the file you should use the submit command as you have for previous projects

submit cs201 Proj3 proj3.c (followed by all other files necessary to compile your project)

You can check your submission by using the command:

submitls cs201 Proj3

CSEE | 201 | 201 S'02 | lectures | news | help

Monday, 01-Apr-2002 11:12:45 EST