Cody

# Problem 821. Pentago: find winning move

Solution 1927839

Submitted on 9 Sep 2019 by Le Cong Hieu
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
board =[0 0 0 0 2 1 1 2 2 2 1 0 0 0 0 1 0 0 0 2 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; pos_correct = [5 2]; rot_correct = []; [pos rot] = pentago_win(board); assert(isequal(pos,pos_correct) && isequal(rot,rot_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In pentago_win (line 2) In ScoringEngineTestPoint1 (line 9) In solutionTest (line 3)] pos = [] rot = []

2   Pass
board =[0 0 0 0 1 0 1 2 2 2 1 0 0 0 0 1 1 0 0 2 2 2 0 0 0 2 0 1 0 0 0 0 0 0 0 0]; pos_correct = [5 5]; rot_correct = [0 0;0 1]; [pos rot] = pentago_win(board); assert(isequal(pos,pos_correct) && isequal(rot,rot_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In pentago_win (line 2) In ScoringEngineTestPoint2 (line 9) In solutionTest (line 5)] pos = [] rot = []

3   Pass
board =[0 0 1 1 1 2 2 2 0 2 2 0 0 0 1 0 1 0 0 2 0 2 0 0 0 0 0 1 0 0 0 0 0 0 0 0]; pos_correct = [2 3]; rot_correct = [-1 0;0 0]; [pos rot] = pentago_win(board); assert(isequal(pos,pos_correct) && isequal(rot,rot_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In pentago_win (line 2) In ScoringEngineTestPoint3 (line 9) In solutionTest (line 7)] pos = [] rot = []

4   Pass
board =[1 0 2 1 1 2 2 0 0 2 2 0 0 0 1 0 1 0 1 2 0 2 0 0 0 1 2 1 0 0 0 0 1 2 0 0]; pos_correct = []; rot_correct = []; [pos rot] = pentago_win(board); assert(isequal(pos,pos_correct) && isequal(rot,rot_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In pentago_win (line 2) In ScoringEngineTestPoint4 (line 9) In solutionTest (line 9)] pos = [] rot = []

5   Pass
board =[1 0 2 1 2 0 2 0 0 2 1 0 0 0 1 1 2 0 2 2 0 2 0 0 0 1 2 1 0 0 0 0 1 2 0 1]; pos_correct = [1 6]; rot_correct = [0 0;-1 0]; [pos rot] = pentago_win(board); assert(isequal(pos,pos_correct) && isequal(rot,rot_correct))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In pentago_win (line 2) In ScoringEngineTestPoint5 (line 9) In solutionTest (line 11)] pos = [] rot = []