Question: (Matlab) need to modify the code: Player fails the game if you cannot make it within 3 tries. Player can do this game up to

(Matlab) need to modify the code: Player fails the game if you cannot make it within 3 tries. Player can do this game up to 10 times. If player input is larger than 10, it will display Dumb and immediately stop the game.

%-----------------------------------------------------------

while(1)

count=0;

guess=input('Guess a number between 0 to 10 ');

if(R>guess)

disp('Your guess is too small')

elseif (R

disp('Your guess is too large')

elseif (R==guess) disp('You are correct! It is '); guess

R=floor( rand()*10 );

end

count=count+1;

if(count==3)

break;

end

end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!