Cody

Problem 2482. Card Game

Solution 2843949

Submitted on 16 Aug 2020 by Kevin Molina
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

c = Columns 1 through 29 50 27 9 -1 4 21 -6 35 24 2 -38 -23 14 -45 20 51 -36 16 43 33 -41 -37 -34 1 29 -20 23 7 -15 Columns 30 through 50 -26 -10 31 32 40 13 12 37 -24 46 15 5 39 -27 48 -35 10 -39 25 -44 36 c = Columns 1 through 29 50 27 9 100 4 21 100 35 24 2 100 100 14 100 20 51 100 16 43 33 100 100 100 1 29 100 23 7 100 Columns 30 through 50 100 100 31 32 40 13 12 37 100 46 15 5 39 100 48 100 10 100 25 100 36 ic = 24 y = 47 c = Columns 1 through 29 82 59 41 31 36 53 26 67 56 34 -6 9 46 -13 52 83 -4 48 75 65 -9 -5 -2 61 12 55 39 17 6 Columns 30 through 49 22 63 64 72 45 44 69 8 78 47 37 71 5 80 -3 42 -7 57 -12 68 c = Columns 1 through 29 82 59 41 31 36 53 26 67 56 34 100 9 46 100 52 83 100 48 75 65 100 100 100 61 12 55 39 17 6 Columns 30 through 49 22 63 64 72 45 44 69 8 78 47 37 71 5 80 100 42 100 57 100 68 ic = 42 y = 19 c = Columns 1 through 29 52 29 11 1 6 23 -4 37 26 4 -36 -21 16 -43 22 53 -34 18 45 35 -39 -35 -32 31 -18 25 9 -13 -24 Columns 30 through 48 -8 33 34 42 15 14 39 -22 48 17 7 41 50 -33 12 -37 27 -42 38 c = Columns 1 through 29 52 29 11 1 6 23 100 37 26 4 100 100 16 100 22 53 100 18 45 35 100 100 100 31 100 25 9 100 100 Columns 30 through 48 100 33 34 42 15 14 39 100 48 17 7 41 50 100 12 100 27 100 38 ic = 4 y = 45 c = Columns 1 through 29 64 41 23 18 35 8 49 38 16 -24 -9 28 -31 34 65 -22 30 57 47 -27 -23 -20 43 -6 37 21 -1 -12 4 Columns 30 through 47 45 46 54 27 26 51 -10 60 29 19 53 62 -21 24 -25 39 -30 50 c = Columns 1 through 29 64 41 23 18 35 8 49 38 16 100 100 28 100 34 65 100 30 57 47 100 100 100 43 100 37 21 100 100 4 Columns 30 through 47 45 46 54 27 26 51 100 60 29 19 53 62 100 24 100 39 100 50 ic = 29 y = 36 c = Columns 1 through 29 71 48 30 25 42 15 56 45 23 -17 -2 35 -24 41 72 -15 37 64 54 -20 -16 -13 50 1 44 28 6 -5 52 Columns 30 through 46 53 61 34 33 58 -3 67 36 26 60 69 -14 31 -18 46 -23 57 c = Columns 1 through 29 71 48 30 25 42 15 56 45 23 100 100 35 100 41 72 100 37 64 54 100 100 100 50 1 44 28 6 100 52 Columns 30 through 46 53 61 34 33 58 100 67 36 26 60 69 100 31 100 46 100 57 ic = 24 y = 26 c = Columns 1 through 29 53 30 12 7 24 -3 38 27 5 -35 -20 17 -42 23 54 -33 19 46 36 -38 -34 -31 32 26 10 -12 -23 34 35 Columns 30 through 45 43 16 15 40 -21 49 18 8 42 51 -32 13 -36 28 -41 39 c = Columns 1 through 29 53 30 12 7 24 100 38 27 5 100 100 17 100 23 54 100 19 46 36 100 100 100 32 26 10 100 100 34 35 Columns 30 through 45 43 16 15 40 100 49 18 8 42 51 100 13 100 28 100 39 ic = 9 y = 48 c = Columns 1 through 29 54 31 13 8 25 -2 39 28 -34 -19 18 -41 24 55 -32 20 47 37 -37 -33 -30 33 27 11 -11 -22 35 36 44 Columns 30 through 44 17 16 41 -20 50 19 9 43 52 -31 14 -35 29 -40 40 c = Columns 1 through 29 54 31 13 8 25 100 39 28 100 100 18 100 24 55 100 20 47 37 100 100 100 33 27 11 100 100 35 36 44 Columns 30 through 44 17 16 41 100 50 19 9 43 52 100 14 100 29 100 40 ic = 4 y = 50 c = Columns 1 through 29 31 8 -10 2 -25 16 5 -57 -42 -5 -64 1 32 -55 -3 24 14 -60 -56 -53 10 4 -12 -34 -45 12 13 21 -6 Columns 30 through 43 -7 18 -43 27 -4 -14 20 29 -54 -9 -58 6 -63 17 c = Columns 1 through 29 31 8 100 2 100 16 5 100 100 100 100 1 32 100 100 24 14 100 100 100 10 4 100 100 100 12 13 21 100 Columns 30 through 43 100 18 100 27 100 100 20 29 100 100 100 6 100 17 ic = 12 y = 66 c = Columns 1 through 29 16 -7 -25 -13 -40 1 -10 -72 -57 -20 -79 17 -70 -18 9 -1 -75 -71 -68 -5 -11 -27 -49 -60 -3 -2 6 -21 -22 Columns 30 through 42 3 -58 12 -19 -29 5 14 -69 -24 -73 -9 -78 2 c = Columns 1 through 29 16 100 100 100 100 1 100 100 100 100 100 17 100 100 9 100 100 100 100 100 100 100 100 100 100 100 6 100 100 Columns 30 through 42 3 100 12 100 100 5 14 100 100 100 100 100 2 ic = 6 y = 81 c = Columns 1 through 29 20 -3 -21 -9 -36 -6 -68 -53 -16 -75 21 -66 -14 13 3 -71 -67 -64 -1 -7 -23 -45 -56 1 2 10 -17 -18 7 Columns 30 through 41 -54 16 -15 -25 9 18 -65 -20 -69 -5 -74 6 c = Columns 1 through 29 20 100 100 100 100 100 100 100 100 100 21 100 100 13 3 100 100 100 100 100 100 100 100 1 2 10 100 100 7 Columns 30 through 41 100 16 100 100 9 18 100 100 100 100 100 6 ic = 24 y = 77 c = Columns 1 through 29 75 52 34 46 19 49 -13 2 39 -20 76 -11 41 68 58 -16 -12 -9 54 48 32 10 -1 57 65 38 37 62 1 Columns 30 through 40 71 40 30 64 73 -10 35 -14 50 -19 61 c = Columns 1 through 29 75 52 34 46 19 49 100 2 39 100 76 100 41 68 58 100 100 100 54 48 32 10 100 57 65 38 37 62 1 Columns 30 through 40 71 40 30 64 73 100 35 100 50 100 61 ic = 29 y = 22 c = Columns 1 through 29 6 -17 -35 -23 -50 -20 -82 -67 -30 -89 7 -80 -28 -1 -11 -85 -81 -78 -15 -21 -37 -59 -70 -12 -4 -31 -32 -7 2 Columns 30 through 39 -29 -39 -5 4 -79 -34 -83 -19 -88 -8 c = Columns 1 through 29 6 100 100 100 100 100 100 100 100 100 7 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 2 Columns 30 through 39 100 100 100 4 100 100 100 100 100 100 ic = 29 y = 92 c = Columns 1 through 29 -3 -26 -44 -32 -59 -29 -91 -76 -39 -98 -2 -89 -37 -10 -20 -94 -90 -87 -24 -30 -46 -68 -79 -21 -13 -40 -41 -16 -38 Columns 30 through 38 -48 -14 -5 -88 -43 -92 -28 -97 -17 c = Columns 1 through 29 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 Columns 30 through 38 100 100 100 100 100 100 100 100 100 ic = 1 y = 96 c = Columns 1 through 29 49 31 43 16 46 -16 -1 36 -23 73 -14 38 65 55 -19 -15 -12 51 45 29 7 -4 54 62 35 34 59 37 27 Columns 30 through 37 61 70 -13 32 -17 47 -22 58 c = Columns 1 through 29 49 31 43 16 46 100 100 36 100 73 100 38 65 55 100 100 100 51 45 29 7 100 54 62 35 34 59 37 27 Columns 30 through 37 61 70 100 32 100 47 100 58 ic = 21 y = 31 c = Columns 1 through 29 46 28 40 13 43 -19 -4 33 -26 70 -17 35 62 52 -22 -18 -15 48 42 26 -7 51 59 32 31 56 34 24 58 Columns 30 through 36 67 -16 29 -20 44 -25 55 c = Columns 1 through 29 46 28 40 13 43 100 100 33 100 70 100 35 62 52 100 100 100 48 42 26 100 51 59 32 31 56 34 24 58 Columns 30 through 36 67 100 29 100 44 100 55 ic = 4 y = 40 c = Columns 1 through 29 32 14 26 29 ...

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!