Cody

# Problem 58. Tic Tac Toe FTW

Solution 2011927

Submitted on 10 Nov 2019 by Weiyang Zhang
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
a = [ 1 0 1 0 -1 0 -1 -1 1]; b = [4 8]; out = ticTacToe(a); assert(isequal(out(:), b(:)))

opt = 1 -2 2 opt1 = 2 0 -1 opt = 0 -1 2 opt1 = 3 -1 -1 wins = 4 opt = 0 -2 3 opt1 = 2 0 -1 wins = 4 8

2   Pass
a = [ 1 0 0 0 -1 0 -1 0 1]; b = [0]; out = ticTacToe(a); assert(isequal(out(:), b(:)))

opt = 1 -1 1 opt1 = 1 0 0 opt = 0 0 1 opt1 = 2 -1 0 opt = 0 0 1 opt1 = 1 -1 1 opt = 0 -1 2 opt1 = 2 -1 0 opt = 0 -1 2 opt1 = 1 0 0

3   Pass
a = [ 1 0 0 0 1 -1 1 -1 -1]; b = [2 7]; out = ticTacToe(a); assert(isequal(out(:), b(:)))

opt = 3 0 -2 opt1 = 1 1 -1 wins = 2 opt = 2 1 -2 opt1 = 2 0 -1 opt = 2 0 -1 opt1 = 2 0 -1 wins = 2 7

4   Pass
a = [ 1 0 0 -1 1 -1 1 -1 0]; b = [7 9]; out = ticTacToe(a); assert(isequal(out(:), b(:)))

opt = 1 1 -1 opt1 = 2 -1 0 opt = 1 0 0 opt1 = 2 -1 0 wins = 7 opt = 1 0 0 opt1 = 1 -1 1 wins = 7 9