Skip to content

XDwightsBeetsX/sudoku

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sudoku

Solve sudoku puzzles w/ C++ !

Input Output
puzzle puzzle

Install

  • Download the repo or the .zip directory from the github repo

    > git clone https://github.com/XDwightsBeetsX/sudoku

Usage

  1. 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;
    }
  2. Compile the executable with Make, g++, or similar. I like using MinGW's compilers...

    > make all
  3. Run the solver

    > make run

see samples in the input folder

view the code structure

with help from this tutorialspoint tutorial