Cody

# Problem 821. Pentago: find winning move

Solution 2073834

Submitted on 29 Dec 2019
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))

A = 1 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 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1 t = 0 0 0 -1 t = [] A = 0 1 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 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1 t = 0 0 0 -1 t = [] A = 0 0 1 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 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1 t = 0 0 0 -1 t = [] A = 0 0 0 1 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 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1 t = 0 0 0 -1 t = [] A = 0 0 0 0 2 1 1 2 2 2 1 1 0 0 0 1 0 0 0 2 1 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 t = 1 0 0 0 t = -1 0 0 0 t = 0 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0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1 t = 0 0 0 -1 t = [] A = 0 0 0 0 2 1 1 2 2 2 1 0 0 0 0 1 0 0 0 2 1 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1 t = 0 0 0 -1 t = [] A = 0 0 0 0 2 1 1 2 2 2 1 0 0 0 0 1 0 0 0 2 1 2 0 1 0 0 0 0 0 0 0 0 0 0 0 0 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1 t = 0 0 0 -1 t = [] A = 0 0 0 0 2 1 1 2 2 2 1 0 0 0 0 1 0 0 0 2 1 2 0 0 1 0 0 0 0 0 0 0 0 0 0 0 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1 t = 0 0 0 -1 t = [] A = 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 1 0 0 0 0 0 0 0 0 0 0 p = 5 2

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))

A = 1 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 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1 t = 0 0 0 -1 t = [] A = 0 1 0 0 1 0 1 2 2 2 1 0 0 0 0 1 1 0 0 2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 1 2 0 1 0 0 0 0 0 0 0 0 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1 t = 0 0 0 -1 t = [] A = 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 1 1 0 0 0 0 0 0 0 0 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1 t = 0 0 0 -1 t = [] A = 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 1 0 0 0 0 0 0 0 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1

3   Fail
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))

A = 1 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 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1 t = 0 0 0 -1 t = [] A = 0 1 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 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1 t = 0 0 0 -1 t = [] A = 0 0 1 1 1 2 2 2 1 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 t = 1 0 0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0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1 t = 0 0 0 -1 t = [] A = 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 1 0 0 0 0 0 0 0 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1 t = 0 0 0 -1 t = [] A = 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 1 0 0 0 0 0 0 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1 t = 0 0 0 -1 t = [] A = 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 1 0 0 0 0 0 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1 t = 0 0 0 -1 t = [] A = 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 1 0 0 0 0 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1 t = 0 0 0 -1 t = [] A = 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 1 0 0 0 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 ...

Assertion failed.

4   Fail
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,r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.

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))

A = 1 1 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 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0 t = 0 0 0 1 t = 0 0 0 -1 t = [] A = 1 0 2 1 2 1 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 t = 1 0 0 0 t = -1 0 0 0 t = 0 1 0 0 t = 0 -1 0 0 t = 0 0 1 0 t = 0 0 -1 0