Solve sudoku puzzles w/ C++ !
Input | Output |
---|---|
![]() |
![]() |
-
Download the repo or the
.zip
directory from the github repo> git clone https://github.com/XDwightsBeetsX/sudoku
-
Edit/Create the
input/input.csv
file with the.csv
-formatted 9x9 sudoku puzzle.Make sure you update the
main.cpp
if 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