Program Description for Developers
This program was written in MATLAB with many variables and commands. Once the program runs, it shows a message box saying Begin your bet using ‘f=msgbox()’. Then, the player is asked to type in the Betting_amount at the ‘Input’ variable. Once the player type in the amount, a ‘for’ loop is created to print out statement ‘Choose your betting number’ and show image of the spinning board by ‘imshow’ code every time a new player bets on. The player type in the betting number at input variable at input_bet. Board is a vector of [1,1,1,1,1,1,2,2,2,2,3,3,3,5,5,10]. The board gives out random variable board_output by pos=randi(length(board)), board_output=board(pos) commands. After the variable output is made, if, elseif, else statements are used to show image of the spun board. For example, if board_output==1, imshow(‘roll board 1s. png’) elseif for board_output==2,3,5 and else statement for 10. The player will see the image of the spun board’s number outcome and if they guessed it right, they will win money times the number that they betted on, but if not, they will lose their money. For this, if elseif, else statement is used. For example, if board_output==1 && input_bet ==board_output, result =betting_amount*1. And another if, else statement is written so that the player will be noticed with the message that they have won or lost the game. If input_bet (the variable betting number that the player has chosen) is same as the board_output (the random vector that resulted from spinning board) the player is noticed of ‘Player Wins’ by fprintf command, if not, else command is used to print out that ‘Player lost. Bet again!’. The game ends after that and player can play a new game by clearing the commend and running the game again.
Variables
- Betting_Amount: The amount money that player decide to bet
- Input_Bet: The number on the board that player wants to bet on (1,2,3,5 or 10)
- board_output: The random output of number that spinning board stops at.
Game Commands
- ‘CreateStruct.Interpreter=’tex’’, ‘CreateStruct.WindowStyle=’modal’’, ’f=msgbox( )’
It is to create the message box that shows ‘Begin Your Bet’ once the program runs.
- ‘for…end’ loop
It is to make a loop goes on for the designated amount of times. It prints out message and show image of the numbered board every different variable of number the player bets.
- ‘pos=randi (length( ))’
It is to pick out a random number output out of the numbers written on the board.
- ‘If…elseif…else…end’
It is to set up an outcome of different situations if the statement is true. If board stops at 1, it shows image of the board stopped at 1. And goes on for 2,3,5 and 10 by elseif and else statement.