-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkubok_solver.h
31 lines (20 loc) · 840 Bytes
/
kubok_solver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef KUBOK_SOLVER_H
#define KUBOK_SOLVER_H
#include "file_parser.h"
#include <vector>
#include <iostream>
using namespace std;
class KubokSolver
{
private:
Puzzle puzzle;
bool is_valid(const vector<vector<int> > &grid, const vector<int> &row_sums, const vector<int> &col_sums);
bool isInvalidPlace(vector<vector<int> > &grid, const vector<int> &row_sums, const vector<int> &col_sums, int row, int col, int num);
bool solve(vector<vector<int> > &grid, const vector<int> &row_sums, const vector<int> &col_sums, int row, int col, vector<bool> &used_numbers);
bool validRowColSum(vector<vector<int> > &grid, const vector<int> &row_sums, const vector<int> &col_sums, int row, int col);
public:
explicit KubokSolver(const Puzzle &puz);
bool solve();
void displayResult();
};
#endif // KUBOK_SOLVER_H