Excel solver that uses circular references only---no macros!

Programs which generate, solve, and analyze Sudoku puzzles

Excel solver that uses circular references only---no macros!

Postby marshall » Mon Jun 26, 2006 10:16 pm

I've created a solver in Excel that will find a solution (if one exists) from any starting grid and also determine if that solution is unique. However, this one doesn't use any macros, just (giant, horrible) spreadsheet formulas!

The algorithm is simple. A cell is filled with a value N if either:
  1. no other value can legally occupy that cell, or
  2. N caanot occupy any other cell in the row/column/3x3 block.
When this approach gets stuck, brute force kicks in.

Sounds easy, but implementing it using only Excel spreadsheet functions sure took some thought, especially the guessing and backtracking part.

The file is available here: XLS (310k) - ZIP (43k)

Instructions are included in the file. Since circular references are used heavily, it defaults to manual calculation. So you need to press F9 to make things happen. Switching to automatic calculation works too, just make sure that the "reset" cell is on (see instructions), or it'll take forever to enter the starting clues!

I welcome feedback, especially if you find any bugs!

--
Marshall
marshall
 
Posts: 1
Joined: 26 June 2006

Postby underquark » Mon Jun 26, 2006 11:06 pm

Quick - at medium puzzles, at least - on an fairly lowly Athlon 1800+, 256Mb, Win XP with SP2. Some form of copy/paste data entry would be good - e.g accept grids from this forum such as:

Code: Select all
+---+---+---+       
|291|...|..8|       
|438|179|256|       
|.5.|482|391|       
+---+---+---+       
|..3|8..|...|       
|.2.|...|.8.|       
|.8.|..6|1..|       
+---+---+---+       
|872|9..|.3.|       
|91.|35.|..2|       
|3.5|...|.1.|       
+---+---+---+
underquark
 
Posts: 299
Joined: 06 September 2005

Postby sb1920alk » Wed Jul 18, 2007 12:45 am

marshall,

I'm not sure if you still frequent this forum, but nice job on the brute force method.

Let me see if I have this correct, once it has a valid solution, it tries for a second solution to see if there more than one exists, and then displays "Multiple solutions found"? How much more difficult would it be to have it count the number of solutions, stopping at some arbitrarily sufficient number?

Regards,
sb1920alk
 
Posts: 18
Joined: 13 June 2007


Return to Software