- #1
Judas543
- 6
- 0
This script looks easy but from staring at it for countless times and referring to a book, I can't figure it out...I'm really stressing out
Anyways these are the instructions...So you need 1 main script and then a function script
1.You are playing a game where you roll a die 12 times. In Matlab, you simulate each result by generating a random number between [1...6] (1 point)
2.If you run a “ONE” or a “FIVE” at least six times, you win 2 dollars, or if you run “THREE” three times you win 1 dollar. (2 points)
3.Create a Matlab script that calls a function “diceGame” (1 point) that takes in a vector representing the 12 dice values and return the amount of money won.
This is what I have right now..Missing some stuff though
What I do know that I need to have a "count"
for k = 1:12
dice_result = ceil(rand * 6);
end
Anyways these are the instructions...So you need 1 main script and then a function script
1.You are playing a game where you roll a die 12 times. In Matlab, you simulate each result by generating a random number between [1...6] (1 point)
2.If you run a “ONE” or a “FIVE” at least six times, you win 2 dollars, or if you run “THREE” three times you win 1 dollar. (2 points)
3.Create a Matlab script that calls a function “diceGame” (1 point) that takes in a vector representing the 12 dice values and return the amount of money won.
This is what I have right now..Missing some stuff though
What I do know that I need to have a "count"
for k = 1:12
dice_result = ceil(rand * 6);
end