Cody

# Problem 2346. Tic Tac Toe Solver

Solution 450350

Submitted on 5 Jun 2014 by Guillaume
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 = [1 0 0; 0 1 0; 1 0 1]; win_ans = [1 3]; assert(isequal(ttt_checker(board),win_ans))

2   Pass
%% board = [1 0 1; 0 1 0; 0 1 0]; win_ans = [-1 0]; assert(isequal(ttt_checker(board),win_ans))

3   Pass
%% board = zeros(3,3,2); win_ans = zeros(2,2); board(:,:,1) = [0 1 0; 1 1 1; 1 0 0]; win_ans(1,:) = [1 1]; board(:,:,2) = [0 0 0; 1 1 0; 0 1 1]; win_ans(2,:) = [0 1]; assert(isequal(ttt_checker(board),win_ans))

4   Pass
%% board = zeros(3,3,4); win_ans = zeros(4,2); board(:,:,1) = [1 0 1; 0 1 1; 0 1 0]; win_ans(1,:) = [-1 0]; board(:,:,2) = [0 0 1; 0 1 0; 0 1 1]; win_ans(2,:) = [0 2]; board(:,:,3) = [1 1 1; 1 0 0; 0 1 0]; win_ans(3,:) = [1 1]; board(:,:,4) = [1 0 1; 0 0 0; 0 1 1]; win_ans(4,:) = [0 1]; assert(isequal(ttt_checker(board),win_ans))

5   Pass
%% board = zeros(3,3,5); win_ans = zeros(5,2); board(:,:,1) = [1 1 0; 0 0 1; 0 1 0]; win_ans(1,:) = [0 3]; board(:,:,2) = [0 0 1; 1 1 0; 0 1 1]; win_ans(2,:) = [-1 0]; board(:,:,3) = [1 1 0; 0 1 1; 0 1 0]; win_ans(3,:) = [1 2]; board(:,:,4) = [1 0 1; 1 0 0; 0 0 1]; win_ans(4,:) = [0 2]; board(:,:,5) = [1 0 1; 0 1 0; 0 1 1]; win_ans(5,:) = [1 3]; assert(isequal(ttt_checker(board),win_ans))