Cody

Problem 2482. Card Game

Solution 2264677

Submitted on 8 May 2020 by Austin Lodish
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   Pass
for i=1:randi(1000) vec = randperm(100); end vec = randperm(100); a = vec(1:50); % given to bot b = vec(51:100); % given to player you = 0; bot = 0; for i = 1:50 c = call(a(1),b); if ~ismember(c,b) while(1) end end if c>a(1) you = you + 1; else bot = bot + 1; end b(b==c)=[]; a(1)=[]; end if you<floor(50*0.75) while(1) disp('not enough wins'); end end

y = 52 y = 10 y = 59 y = 54 y = 96 y = 31 y = 98 y = 11 y = 88 y = 34 y = 17 y = 18 y = 63 y = 90 y = 71 y = 46 y = 65 y = 5 y = 2 y = 81 y = 85 y = 19 y = 66 y = 36 y = 67 y = 42 y = 40 y = 26 y = 68 y = 99 y = 23 y = 20 y = 83 y = 78 y = 91 y = 21 y = 69 y = 72 y = 27 y = 37 y = 92 y = 73 y = 28 y = 75 y = 29 y = 100 y = 44 y = 43 y = 38 y = 3

Suggested Problems

More from this Author44

Community Treasure Hunt

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

Start Hunting!