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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started