Cody

# Problem 3690. OXO counting

Solution 2074524

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

Index in position 1 exceeds array bounds (must not exceed 1). Error in count_OXO (line 4) if board(i,:)=='OXO' Error in Test1 (line 3) assert(isequal(count_OXO(board),y_correct))

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

Index in position 1 exceeds array bounds. Error in count_OXO (line 4) if board(i,:)=='OXO' Error in Test2 (line 3) assert(isequal(count_OXO(board),y_correct))

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

Index in position 1 exceeds array bounds (must not exceed 1). Error in count_OXO (line 4) if board(i,:)=='OXO' Error in Test3 (line 3) assert(isequal(count_OXO(board),y_correct))

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

Index in position 1 exceeds array bounds (must not exceed 1). Error in count_OXO (line 4) if board(i,:)=='OXO' Error in Test4 (line 3) assert(isequal(count_OXO(board),y_correct))

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

Index in position 1 exceeds array bounds (must not exceed 1). Error in count_OXO (line 4) if board(i,:)=='OXO' Error in Test5 (line 3) assert(isequal(count_OXO(board),y_correct))

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

Matrix dimensions must agree. Error in count_OXO (line 4) if board(i,:)=='OXO' Error in Test6 (line 3) assert(isequal(count_OXO(board),y_correct))

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

Index in position 1 exceeds array bounds (must not exceed 1). Error in count_OXO (line 4) if board(i,:)=='OXO' Error in Test7 (line 3) assert(isequal(count_OXO(board),y_correct))

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

Matrix dimensions must agree. Error in count_OXO (line 4) if board(i,:)=='OXO' Error in Test8 (line 3) assert(isequal(count_OXO(board),y_correct))

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

Matrix dimensions must agree. Error in count_OXO (line 4) if board(i,:)=='OXO' Error in Test9 (line 3) assert(isequal(count_OXO(board),y_correct))

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

Matrix dimensions must agree. Error in count_OXO (line 4) if board(i,:)=='OXO' Error in Test10 (line 3) assert(isequal(count_OXO(board),y_correct))

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

Matrix dimensions must agree. Error in count_OXO (line 4) if board(i,:)=='OXO' Error in Test11 (line 3) assert(isequal(count_OXO(board),y_correct))

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   Pass
board = ['OXX';'XXX';'XOO']; y_correct = 1; assert(isequal(count_OXO(board),y_correct))

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

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

Matrix dimensions must agree. Error in count_OXO (line 4) if board(i,:)=='OXO' Error in Test16 (line 3) 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))

Matrix dimensions must agree. Error in count_OXO (line 4) if board(i,:)=='OXO' Error in Test17 (line 3) assert(isequal(count_OXO(board),y_correct))

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

Matrix dimensions must agree. Error in count_OXO (line 4) if board(i,:)=='OXO' Error in Test18 (line 3) assert(isequal(count_OXO(board),y_correct))

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

Matrix dimensions must agree. Error in count_OXO (line 4) if board(i,:)=='OXO' Error in Test19 (line 3) assert(isequal(count_OXO(board),y_correct))

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

Index in position 2 exceeds array bounds (must not exceed 1). Error in count_OXO (line 7) if board(:,i) == ['O';'X';'O'] Error in Test20 (line 3) assert(isequal(count_OXO(board),y_correct))

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.