You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Martins Eglitis 7d07e06a27 Update solver 1 month ago
LICENSE Gofmt the project and added license 2 months ago
README.md Finished with tests and multiple solutions 2 months ago
cases_test.go Gofmt the project and added license 2 months ago
solver.go Update solver 1 month ago
solver_test.go Gofmt the project and added license 2 months ago

README.md

sudoku-solver

Sudoku solver is a brute-force recursive solver for 9x9 Sudoku puzzles.

Usage

package main

import (
    "fmt"
    "git.sitilge.id.lv/sitilge/sudoku-solver"
    "log"
)

func main() {
    input := [9][9]uint8{
        {0, 4, 2, 0, 0, 0, 0, 0, 5},
        {0, 0, 0, 6, 3, 2, 0, 8, 0},
        {0, 8, 0, 0, 4, 0, 2, 0, 0},
        {0, 0, 0, 0, 0, 0, 0, 0, 0},
        {7, 1, 5, 0, 6, 8, 3, 4, 0},
        {9, 0, 8, 3, 5, 0, 7, 6, 1},
        {0, 9, 1, 0, 0, 6, 0, 0, 0},
        {0, 0, 0, 0, 2, 0, 1, 9, 0},
        {0, 0, 6, 1, 0, 0, 0, 5, 0},
    }
    
    //Get a new matrix.
    m, err := solver.NewMatrix(input)
    if err != nil {
        log.Fatal(err)
    }

    //Solve the puzzle.
    solutions := m.Solve()

    //Print out the solutions.
    for solution := range solutions {
        fmt.Println(&solution)
    }
}