Cody

# Problem 3690. OXO counting

Solution 1719984

Submitted on 3 Feb 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   Fail
board = 'OXO'; y_correct = 1; assert(isequal(count_OXO(board),y_correct))

Assertion failed.

2   Pass
board = ''; y_correct = 0; assert(isequal(count_OXO(board),y_correct))

3   Pass
board = ' '; y_correct = 0; assert(isequal(count_OXO(board),y_correct))

4   Pass
board = ' X '; y_correct = 0; assert(isequal(count_OXO(board),y_correct))

5   Pass
board = 'O O'; y_correct = 0; assert(isequal(count_OXO(board),y_correct))

6   Fail
board = 'O O OXO X'; y_correct = 1; assert(isequal(count_OXO(board),y_correct))

Assertion failed.

7   Pass
board = 'OOX'; y_correct = 0; assert(isequal(count_OXO(board),y_correct))

8   Fail
board = 'OOXOX'; y_correct = 1; assert(isequal(count_OXO(board),y_correct))

Assertion failed.

9   Pass
board = 'OOX OX'; y_correct = 0; assert(isequal(count_OXO(board),y_correct))

10   Pass
board = 'OOXXO'; y_correct = 0; assert(isequal(count_OXO(board),y_correct))

11   Fail
board = 'OOXOOOOXXOXOX'; y_correct = 2; assert(isequal(count_OXO(board),y_correct))

Assertion failed.

12   Pass
board = ['OOO';'OXO';'OXO']; y_correct = 4; assert(isequal(count_OXO(board),y_correct))

13   Pass
board = ['OOO';'OXO';'OOO']; y_correct = 4; assert(isequal(count_OXO(board),y_correct))

14   Fail
board = ['OXX';'XXX';'XOO']; y_correct = 1; assert(isequal(count_OXO(board),y_correct))

Assertion failed.

15   Fail
board = ['OOO';'X O';'OXO']; y_correct = 2; assert(isequal(count_OXO(board),y_correct))

Assertion failed.

16   Pass
board = [' ';' ';' ';' ']; y_correct = 0; assert(isequal(count_OXO(board),y_correct))

17   Fail
board = ['O OO';'O XO';'OOX ']; y_correct = 1; assert(isequal(count_OXO(board),y_correct))

Assertion failed.

18   Fail
board = ['OXXOXO';' OXO X';'XOXOXO']; y_correct = 6; assert(isequal(count_OXO(board),y_correct))

Assertion failed.

19   Fail
board = ['OXOXOXO';'OXOXO X';'XOOOXOX']; y_correct = 8; assert(isequal(count_OXO(board),y_correct))

Assertion failed.

20   Fail
board = 'OXO'.'; y_correct = 1; assert(isequal(count_OXO(board),y_correct))

Assertion failed.

21   Pass
% Keep in mind that Test Suite may be extended, so try to write general solution. % If you find any bugs, please report it to me. Thanks! % Have fun.