Example #1
0
int solve(Sudoku &su) {
    vector<int> av = (*cursor)->av;
    for (auto v:av)
        if (su.Is_Validate((*cursor)->row, (*cursor)->col, v)) {
            (*cursor)->value = v;
            ++cursor;
            if (cursor == su.end())
                return 1;
            if (solve(su) == 1)
                return 1;
            (*cursor)->value = 0;
            --cursor;
        }
    return 0;
}
Example #2
0
	bool checkRows(const Sudoku &s)
	{
		return std::all_of(s.begin(), s.end(),
				[this](const Row &r){ return checkList(r, "in row"); });
	}