Solve sudoku puzzles w/ C++ !
| Input | Output |
|---|---|
![]() |
![]() |
-
Download the repo or the
.zipdirectory from the github repo> git clone https://github.com/XDwightsBeetsX/sudoku
-
Edit/Create the
input/input.csvfile with the.csv-formatted 9x9 sudoku puzzle.Make sure you update the
main.cppif necessary.#include "src/SudokuSolver.h" #include "src/SudokuGenerator.h" using namespace std; int main() { // generate puzzles SudokuGenerator SG = SudokuGenerator(); SG.generatePuzzles(10); // solve a puzzle std::string inputFilename = "input/sample.csv"; SudokuSolver SS = SudokuSolver(inputFilename); SS.showProblem(); if (SS.solve()) { SS.showSolution(); SS.writeSolutionToFile(); } return 0; }
-
Compile the executable with Make,
g++, or similar. I like using MinGW's compilers...> make all -
Run the solver
> make run
see samples in the input folder
with help from this tutorialspoint tutorial

