Skip to content

FoxyDingo/SudokuSolver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Created by https://github.com/FoxyDingo

su-solver is a program designed to solve sudoku puzzles of any size. 

To use the su-solver:
run clisp (or any other lisp implementation)
(load "su-solver.fas")
(su-solver state)

Where state is a sudoku puzzle. You can use any of the boards below for example:
run clisp (or any other lisp implementation)
(load "su-solver.fas")
(setf state '( (( )( )( )( )(6)( )(5)( )(3))
   (( )( )( )( )(1)( )( )(2)(4))
   ((5)( )(7)( )( )(4)( )( )( ))
   (( )( )( )(1)( )( )(6)( )(8))
   (( )( )(3)( )( )( )(4)( )( ))
   ((6)( )(2)( )( )(7)( )( )( ))
   (( )( )( )(4)( )( )(1)( )(6))
   ((7)(9)( )( )(2)( )( )( )( ))
   ((8)( )(1)( )(5)( )( )( )( )) ))
(su-solver state)


The board is represented as a list of lists. Each number is a list. Each line is a list of numbers (therefore a list of lists).
The board is a list of lines (a list of lists of lists). Example of some sudoku boards in list form:

EXAMPLE OF SUDOKU BOARDS:

EASY
'( (( )( )( )(2)(8)( )(5)(7)( ))
   (( )( )(6)(1)( )( )(8)( )(3))
   ((7)( )( )(6)( )( )( )( )(9))
   ((1)( )(7)( )( )( )(2)(9)( ))
   ((8)(3)( )( )( )( )( )(4)(1))
   (( )(2)(9)( )( )( )(3)( )(7))
   ((2)( )( )( )( )(8)( )( )(4))
   ((9)( )(3)( )( )(7)(1)( )( ))
   (( )(6)(8)( )(1)(5)( )( )( )))

MEDIUM 
'( (( )( )(7)(1)(2)( )( )( )( ))
   ((3)(2)( )( )( )(5)( )(7)( ))
   (( )( )(5)( )( )(3)( )(4)(9))
   (( )( )(2)( )( )( )(6)( )( ))
   ((9)(6)( )(7)( )(4)( )(2)(5))
   (( )( )(4)( )( )( )(9)( )( ))
   ((2)(5)( )(3)( )( )(4)( )( ))
   (( )(8)( )(4)( )( )( )(3)(1))
   (( )( )( )( )(8)(1)(7)( )( )) )

HARD
'( (( )( )( )(2)(3)(6)( )(9)(5))
   (( )( )( )( )( )( )(2)( )( ))
   ((7)( )( )( )( )( )( )(1)(8))
   (( )( )( )(3)( )( )(9)( )(1))
   (( )( )( )(6)(5)(8)( )( )( ))
   ((5)( )(3)( )( )(7)( )( )( ))
   ((3)(6)( )( )( )( )( )( )(7))
   (( )( )(1)( )( )( )( )( )( ))
   ((2)(9)( )(4)(1)(3)( )( )( )) )

EVIL
'( (( )( )( )( )(6)( )(5)( )(3))
   (( )( )( )( )(1)( )( )(2)(4))
   ((5)( )(7)( )( )(4)( )( )( ))
   (( )( )( )(1)( )( )(6)( )(8))
   (( )( )(3)( )( )( )(4)( )( ))
   ((6)( )(2)( )( )(7)( )( )( ))
   (( )( )( )(4)( )( )(1)( )(6))
   ((7)(9)( )( )(2)( )( )( )( ))
   ((8)( )(1)( )(5)( )( )( )( )) )

16x16 sudoku puzzle:

'( ((  )(8 )(  )(  )   (9 )(  )(  )(3 )   (10)(  )(  )(14)   (  )(  )(6 )(  ))
   ((5 )(  )(15)(  )   (  )(  )(14)(  )   (  )( 1)(  )(  )   (  )(12)(  )(4 ))
   ((  )(  )(  )(  )   (  )(  )(  )(  )   (  )(  )(  )(  )   (  )(  )(5 )(  ))
   ((  )(  )(  )( 6)   (  )(13)(15)( 5)   (16)( 2)( 4)(  )   (7 )(  )(  )(  ))
 
   ((6 )(  )(  )(  )   (  )(12)(  )(15)   (14)(  )(3 )(  )   (  )(  )(  )(5 ))
   ((  )(  )(  )(11)   (1 )(7 )(6 )( 9)   (4 )(12)( 8)( 5)   ( 3)(  )(  )(  ))
   ((  )(1 )(  )(7 )   (  )(5 )(  )(  )   (  )(  )(10)(  )   (16)(  )(14)(  ))
   ((10)(  )(  )(13)   (16)(2 )(  )(  )   (  )(  )(11)(6 )   (15)(  )(  )(12))

   ((13)(  )(  )(4 )   (3 )(16)(  )(  )   (  )(  )(1 )(8 )   (9 )(  )(  )(10))
   ((  )(16)(  )( 2)   (  )( 4)(  )(  )   (  )(  )(14)(  )   (12)(  )(1 )(  ))
   ((  )(  )(  )(1 )   (15)( 9)( 5)( 7)   (2 )(13)(12)(16)   (6 )(  )(  )(  ))
   ((11)(  )(  )(  )   (  )(8 )(  )(12)   ( 7)(  )(15)(  )   (  )(  )(  )(16))

   ((  )(  )(  )(5 )   (  )(11)( 2)( 4)   (13)(10)(6 )(  )   (8 )(  )(  )(  ))
   ((  )(11)(  )(  )   (  )(  )(  )(  )   (  )(  )(  )(  )   (  )(  )(16)(  ))
   (( 9)(  )(3 )(  )   (  )(  )( 8)(  )   (  )(15)(  )(  )   (  )( 7)(  )(2 ))
   ((  )(2 )(  )(  )   (10)(  )(  )(1 )   ( 5)(  )(  )( 9)   (  )(  )(12)(  )) )

About

Lisp program to solve sudokus of any size

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published