Cody

# Problem 58. Tic Tac Toe FTW

Solution 1800650

Submitted on 30 Apr 2019 by CHUANQIANG 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 0 0 -1 0 -1 0 1]; b = ; out = ticTacToe(a); assert(isequal(out(:), b(:)))

count = 1 count = 0 count = 0 count = 0 count = 1 count = 0 count = 1 count = 0 count = 0 count = 0 count = 0 count = 0 count = 1 count = 0 count = 0 left = 1 -1 1 flagl = 0 countl = 2 right = -1 -1 0 flagr = 0 countr = 0 flag = 0 0 0 0 0 0 0 0 output = [] output = 1×0 empty double row vector output = 0

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

count = 2 flagc = 2 0 0 count = 0 count = 1 count = 0 count = 0 count = 0 count = 1 count = 0 count = 0 count = 1 count = 0 count = 0 count = 1 count = 0 count = 0 left = 1 1 -1 flagl = 0 countl = 2 right = 1 1 0 flagr = 0 countr = 2 flagr = 7 flag = 0 0 0 2 0 0 0 7 output = [] output = 2 7

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

count = 2 flagc = 0 0 0 count = 0 count = 1 count = 0 count = 0 count = 0 count = 1 count = 0 count = 0 count = 1 count = 0 count = 0 count = 1 count = 0 count = 0 left = 1 1 0 flagl = 0 countl = 2 flagl = 9 right = 1 1 0 flagr = 0 countr = 2 flagr = 7 flag = 0 0 0 0 0 0 9 7 output = [] output = 7 9

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!