This code is referenced in the following blog post: http://blogs.mathworks.com/community/2015/01/19/robot-game-playing-in-matlab-part-2/
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
b = [0 1 1 0 2;
0 1 2 2 1;
1 0 2 2 2;
1 1 2 2 1;
1 1 2 1 0];
result_correct = 2;
assert(isequal(c4winner(b),result_correct))
|
2 | Pass |
%%
b = [0 0 0 0;
1 0 2 0;
1 1 1 1;
0 0 2 2];
result_correct = 1;
assert(isequal(c4winner(b),result_correct))
|
3 | Pass |
%%
b = [0 0 0 0 0 1;
2 2 0 0 2 2;
0 0 0 0 0 1;
2 0 0 1 1 0;
0 0 0 1 0 0;
0 0 1 0 2 2];
result_correct = 1;
assert(isequal(c4winner(b),result_correct))
|
4 | Pass |
%%
b = [0 0 0 0;
1 0 0 0;
0 0 0 0;
0 0 0 2];
result_correct = 0;
assert(isequal(c4winner(b),result_correct))
|
5 | Pass |
%%
b = [0 0 0 0;
1 1 1 1;
0 0 0 0;
0 0 0 2];
result_correct = 1;
assert(isequal(c4winner(b),result_correct))
|
6 | Pass |
%%
b = [0 0 2 2;
1 0 2 0;
1 2 2 1;
2 0 1 2];
result_correct = 2;
assert(isequal(c4winner(b),result_correct))
|
7 | Pass |
%%
b = [0 0 0 0;
1 0 1 1;
0 0 2 0;
0 2 0 2];
result_correct = 0;
assert(isequal(c4winner(b),result_correct))
|
6063 Solvers
Convert a vector into a number
503 Solvers
274 Solvers
Check that number is whole number
1070 Solvers
373 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!