Game 3: Over Under 7

 

Introduction

Over/Under Seven is a long time simple casino game where players bet each round whether the dice will roll over/under or exactly seven. The payout for winning is twice your bet or quadruple your bet if you guess seven and it lands seven. You can play the game as long as you would like or until you run out of money.

User manual

To win Over/Under seven you must correctly guess whether the roll of to die will be over/under or exactly seven. If you do so you will double your money and grow your winnings, but if not, as you watch your money slowly slip away until your pockets are empty.

  1. To start game, press the green run arrow above the script file.
  2. Then the game will present a list of rules and objectives that you should read and then proceed on with the game once you understand the rules.
  3. Every player will start with $100.
  4. Now you will be asked to place a bet for this round, you will do this by just typing in a number. (ex: 25)
  5. Next, you will choose whether you want to bet over/under or exactly seven. You do this by typing the numbers 2-6 for under, 8-12 for over and 7 for exactly 7.
  6. After these two dice will display on the screen and you will see if you won or lost.
  7. Then the game will ask you to either play again by entering (Y) or end the game by entering (N).
  8. If you play again your bank account will reflect your last round and you repeat the same process, if you choose no your winnings will be projected on the screen.

Program Description

  1. Variables

Money- states the staring amount and money after each round

Playagain – variable that keeps game running while you have more than $0 in your bank and if the user wants to playagain.

rollSum= sums the dice of the two rolls together.

Amount= The amount if the amount of money bet by the user input.

Value = The value the user enters for their bet, either over/under or 7.

Imshow = used from dice.mat puts the two dice displays on the screen with the correct roll.

roll = variable used to keep track of the roll and tell the user if they won or lost comparing their guess to the roll.

  1. Commands

While loop = kept the game on a continuous loop while money > 0 and playagain = true

If statements = were used to keep track of money and tell MatLab to add money when they were right and take away when wrong.

Randi = MatLab command that creates a random roll every new time the game is run or looped.

disp = displays text in (‘ ‘) to command window

fprintf = displays text and accurate value of money to command window.

Game description-

This game is played using a combination of variable, commands, and inputs from the players. To start the game the money variable is set at 100 which gives each player $100 to start. Then the playagain = true is used to start the game because it continues while playAgain = true and money is > 0. Once the game is started a series of input statements are used to ask the user to bet and amount and to guess the dice role. Then the roll command and imshow will roll and randomly appear two dice on the screen and sum the values. After this the if statements are used to go through what the player guessed and what the roll was an award the correct money. Then the user will be asked if they want to play again and can either type Y which will make playagain true and start the over with an updated money or select N which makes playAgain = false and stops the program.

Discussion Under-Over Seven:

The code starts off by presenting an initial pool of money and asking for a bet and a guess for a value under/over seven. It then continues by rolling a random number with 2 dies then evaluates the input value that was entered at the beginning and compares it with the rolled number by using if statements. Depending on the if statement results it then prints out a result and decreases/increases the initial pool of money given at the beginning and repeats until the user quits. The game didn’t have any issues during testing other than the betting pool being small, which was easily increased.

Conclusion and Recommendations Under-Over Seven:

The game is near perfection, the only thing needed is more graphics that don’t just show the rolled value. Other than that, the game’s presentation and idea is good to go. The ‘if’ statements were sufficient in doing the job.