Cody

Solution 1645750

Submitted on 14 Oct 2018
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
for i=1:1000 status=[10,10,10]; while sum(status)~=0 [Row_number, Num_of_lines] = remove_lines(status); if Num_of_lines>status(Row_number) disp('Error: Check number of lines'); result=false; break; end if Num_of_lines<1 disp('Error: You must remove at least one line'); result=false; break; end if Row_number~=1 && Row_number~=2 && Row_number~=3 disp('Error: Row number must be 1, 2 or 3.'); result=false; break; end if numel(Row_number)~=1 || numel(Num_of_lines)~=1 disp('Error: Row number must have one element'); result=false; break; end status(Row_number)=status(Row_number)-Num_of_lines; if sum(status)==0 disp('You lose'); result=false; break; end if sum(status)==1 disp('You win'); result=true; break; end [~,L]=max(status); status(L)=status(L)-randi(status(L)); if sum(status)==0 disp('You win'); result=true; break; end end res(i)=result; end number_of_wins= sum(res) assert(isequal(sum(res),1000))

Error in solution Line: 13 Column: 16 Invalid expression. Check for missing or extra characters.

Suggested Problems

More from this Author18