Variables/Arrays:
numOfPlayers: The number of players inputted by the users
maxDollars: The max amount dollars a player can bet
bet[]: an array of the bets of each player
value[]: the value used to decide whether the user is guessing over or under seven
roll_num[]: an array that holds the values of what the user rolls
i: the increment value that is used in the for loop when going through the players
roll: the random number rolled by two dice, which is summed into roll_num[]
Matlab Game Commands:
- Initially, the user is shown instructions via, fprintf.
- Next, the user is asked for how many players via the input command and recorded in a variable.
- Then, each user is asked for a bet and is recorded with the input command with a for loop that increments through all the players.
- Next, a for loop increments through all the players.
- Within this loop each player is asked to enter a certain number for over or under seven and this value is recorded in an array value[].
- Then, still within this for loop each player rolls two dice and is summed up in roll_num.
- Still within this for loop an if statement is implemented to catch players who picked over seven.
- Within this if statement, we decide whether the player wins with a series of if, else if statements that compare roll_num to 7.
- This is then repeated for players with a value that represents under seven.
- Within these if and else if statements for over and under seven fprintf the results of the game and how much the player wins.