Cody

Solution 1698494

Submitted on 22 Dec 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
A = magic(4); correct = 15; assert(isequal(minimax(A),correct))

ans = 16

Assertion failed.

2   Fail
A = magic(5); correct = 21; assert(isequal(minimax(A),correct))

The logical indices contain a true value outside of the array bounds. Error in minimax (line 3) min(ans(ans==max(a,2)')) Error in Test2 (line 3) assert(isequal(minimax(A),correct))

3   Fail
A = magic(6); n = randi(1024); correct = 34; assert(isequal(minimax(A+n),correct+n))

ans = 490

Assertion failed.

4   Fail
A = [1 2 3; 0 4 5; 6 0 0]; correct = 5; assert(isequal(minimax(A),correct))

The logical indices contain a true value outside of the array bounds. Error in minimax (line 3) min(ans(ans==max(a,2)')) Error in Test4 (line 3) assert(isequal(minimax(A),correct))

5   Fail
A = [1 2 3; 0 4 0; 6 0 5]; correct = 4; assert(isequal(minimax(A),correct))

The logical indices contain a true value outside of the array bounds. Error in minimax (line 3) min(ans(ans==max(a,2)')) Error in Test5 (line 3) assert(isequal(minimax(A),correct))

6   Fail
A = rand(7)+diag(randperm(7)); assert(isequal(floor(minimax(A)),1))

The logical indices contain a true value outside of the array bounds. Error in minimax (line 3) min(ans(ans==max(a,2)')) Error in Test6 (line 2) assert(isequal(floor(minimax(A)),1))

7   Fail
B = [1 2 1; 0 1 0]; correct = 2; assert(isequal(minimax(B),correct))

Matrix dimensions must agree. Error in minimax (line 3) min(ans(ans==max(a,2)')) Error in Test7 (line 3) assert(isequal(minimax(B),correct))

8   Fail
B = magic(6)+magic(6)'; correct = 61; assert(isequal(minimax(B),correct)) % other test suggestions highly welcome

The logical indices contain a true value outside of the array bounds. Error in minimax (line 3) min(ans(ans==max(a,2)')) Error in Test8 (line 3) assert(isequal(minimax(B),correct))