C
CyberDean
I have written a sudoku solver in ruby that finds all solutions using
logic instead of tree-search. Puzzles upto 35x35! are solved as well as
the new sudoku-x puzzles that have two extra diagonal constraints.
Anyone interested is welcome to download it at RubyForge:
http://rubyforge.org/projects/sudoku-x
NB You will need the ruby interpreter to run it, if you are using
Windows then click on this link
http://rubyforge.org/frs/download.php/4174/ruby182-15.exe
It is under the name One-Click-Ruby-Installer, more info to be found
here
http://rubyforge.org/projects/rubyinstaller
Several people are having trouble trying out the example puzzles, so I
hope this helps
For example, here is the first puzzle
=begin # SuDoku 6x6 (1 solution)
s = SuDoku.new 2,3
s.data %w{
001000
604030
500000
000004
060402
000100
}
s.solve
=end
You need to remove the '=' that appear before the words 'begin; & 'end'
so that it looks like this
begin # SuDoku 6x6 (1 solution)
s = SuDoku.new 2,3
s.data %w{
001000
604030
500000
000004
060402
000100
}
s.solve
end
But remember that to try a different puzzle you need to put the '='
back again or else both puzzles will be solved in sucession.
Good luck!
Dean
logic instead of tree-search. Puzzles upto 35x35! are solved as well as
the new sudoku-x puzzles that have two extra diagonal constraints.
Anyone interested is welcome to download it at RubyForge:
http://rubyforge.org/projects/sudoku-x
NB You will need the ruby interpreter to run it, if you are using
Windows then click on this link
http://rubyforge.org/frs/download.php/4174/ruby182-15.exe
It is under the name One-Click-Ruby-Installer, more info to be found
here
http://rubyforge.org/projects/rubyinstaller
Several people are having trouble trying out the example puzzles, so I
hope this helps
For example, here is the first puzzle
=begin # SuDoku 6x6 (1 solution)
s = SuDoku.new 2,3
s.data %w{
001000
604030
500000
000004
060402
000100
}
s.solve
=end
You need to remove the '=' that appear before the words 'begin; & 'end'
so that it looks like this
begin # SuDoku 6x6 (1 solution)
s = SuDoku.new 2,3
s.data %w{
001000
604030
500000
000004
060402
000100
}
s.solve
end
But remember that to try a different puzzle you need to put the '='
back again or else both puzzles will be solved in sucession.
Good luck!
Dean