bool board_has_no_threes(const int board[MAX_SIZE][MAX_SIZE], int size) { for (int i = 0; i < size; i++) if (!row_has_no_threes_of_color(board, size, i, BLUE) || !col_has_no_threes_of_color(board, size, i, BLUE) || !row_has_no_threes_of_color(board, size, i, RED) || !col_has_no_threes_of_color(board, size, i, RED)) { return false; } return true; }
void test_col_has_no_threes_of_color () { cout << "Testing col has no threes" << endl; int board[MAX_SIZE][MAX_SIZE]; // test case 1 string test_board_1[] = {"----", "XXO-", "-XO-", "--O-"}; int size_1 = 4; read_board_from_string(board, test_board_1, size_1); cout << col_has_no_threes_of_color(board, size_1, 1, RED) << endl; // test case 2 string test_board_2[] = {"----", "XXO-", "-XO-", "--O-"}; int size_2 = 4; read_board_from_string(board, test_board_2, size_2); cout << col_has_no_threes_of_color(board, size_2, 2, RED) << endl; // test case 3 string test_board_3[] = {"----", "XXO-", "-XO-", "--O-"}; int size_3 = 4; read_board_from_string(board, test_board_3, size_3); cout << col_has_no_threes_of_color(board, size_3, 2, BLUE) << endl; // test case 4 string test_board_4[] = {"----", "XXO-", "-XO-", "--O-"}; int size_4 = 3; read_board_from_string(board, test_board_4, size_4); cout << col_has_no_threes_of_color(board, size_4, 0, RED) << endl; cout << "End testing col has no threes" << endl; }