Move solving logic to a separate class
This commit is contained in:
parent
3dc9f04650
commit
dd89c1fd6c
4 changed files with 40 additions and 8 deletions
13
solver.cpp
13
solver.cpp
|
|
@ -1,16 +1,13 @@
|
|||
#include "solver/solver.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "solver/puzzle.h"
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
Puzzle puzzle = Puzzle::FromString(
|
||||
Solver solver(
|
||||
"3..4.162.1...8.4....5.2.83..578........7..5.3..29.4..748.53..1.2.3.9...."
|
||||
".7...6.9.");
|
||||
while (puzzle.ApplyNextStep())
|
||||
;
|
||||
if (!puzzle.IsSolved()) {
|
||||
if (!solver.Solve()) {
|
||||
std::cout << "Error! Couldn't Solve" << std::endl;
|
||||
}
|
||||
std::cout << "https://tiramisu.one/sudoku.html?p=" << puzzle.CurrentState()
|
||||
<< "&m=" << puzzle.PencilMarkState() << std::endl;
|
||||
std::cout << solver.StateUrl() << std::endl;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue