Move solving logic to a separate class

This commit is contained in:
Drew Galbraith 2023-05-03 23:56:29 -07:00
parent 3dc9f04650
commit dd89c1fd6c
4 changed files with 40 additions and 8 deletions

View file

@ -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;
}