Cody

# Problem 700. Monty Hall

Solution 2982103

Submitted on 23 Sep 2020
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
win=0; Pass=0; for i=1:100 prize=randi(3); doors=[0 0 0]; pick=Monty(doors); pick=floor(pick); if pick<1 || pick>3 win=0; break; else doors(pick)=1; end if pick==prize % Random select from other doors if rand>0.5 doors(find(doors==0,1))=2; else doors(find(doors==0,1,'last'))=2; end else % % Pick other and not prize door reveal=setxor(prize,setxor(pick,[1 2 3])); doors(reveal)=2; end pick=Monty(doors); pick=floor(pick); if pick==prize win=win+1; end end % Monty Loops win % Display number of wins if win>50,Pass=1;end assert(isequal(Pass,1))

Undefined function 'Monty' for input arguments of type 'double'. Error in Test1 (line 8) pick=Monty(doors);

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!