sudoku

package
v0.0.0-...-d4d1805 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2015 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

sudoku package implements efficient sudoku solver

Index

Constants

View Source
const (
	GridSize        = 9
	RegionSize      = 3
	ConstraintTypes = 4
	NumOfCells      = GridSize * GridSize
	Constraints     = NumOfCells * ConstraintTypes
	Possibilities   = GridSize * GridSize * GridSize
)

Variables

View Source
var (
	InputTooShortError  = errors.New("Input is too short!")
	InputMalformedError = errors.New("Input is malformed!")
)

Functions

func PrintReadableGrid

func PrintReadableGrid(sol string)

Types

type Node

type Node struct {
	Left  *Node
	Right *Node
	Up    *Node
	Down  *Node

	Head *Node

	Col int
	Row int
}

func NodeHeader

func NodeHeader(col int) *Node

func NodeRegular

func NodeRegular(row int, col int) *Node

func (*Node) Cover

func (n *Node) Cover()

type Solver

type Solver struct {
	// contains filtered or unexported fields
}

func InitSolver

func InitSolver(input string) (*Solver, error)

func (*Solver) GetSolution

func (s *Solver) GetSolution() string

func (*Solver) Solve

func (s *Solver) Solve() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL