My function does not work and i don't know how to link my input number n with the simulation of the roulette.
There are 18 red, 18 black and 1 green fields. If the ball lands on the field which the user choose then he gets the money back and gets the same amount of money which he used. if the ball lands not on the field which the user choose then he loose his money.
function [red, black] = n_montecarlo(n)red = [3 12 7 18 9 14 1 16 5 23 30 36 27 34 25 21 19 32];black = [26 35 28 29 22 31 20 33 24 10 8 11 13 6 17 2 4 15];roulette = randi(37); for n = red if roulette == n disp('win') else disp('lose') for n = black if roulette == n disp('win') else disp('lose') end end endendend
Best Answer