Im trying to create a code that modifies a game. This game is you have 3 tries to guess a number 0-10. If you fail 10 times it will end the game and display 'dumb'. I have done all of that up to the point where it displays dumb, but it will not end the game it just continues. What do I need to change for it to end?
R=floor ( rand()*10 );count=0;while (1) for i=1:10 guess=input('Guess a number between 0 to 10 '); if (R>guess) disp('Your guess is too small') elseif (R<guess) disp('Your guess is too large') elseif (R==guess) disp('You are correct! It is ');guess break; end count=count+1 if(count==3) disp('You Failed The Game, Try Again') count=0; if i==10 disp('DUMB') break; end end endend
Best Answer