I too did one back in April - and have modfied it to read (and write) the current intput format. Here's the puzzle that takes a *long* time - I don't remember if it's even solvable, but my solver has been running for over an hour so far ... +-------+-------+-------+ | _ _ _ | _ _ _ | _ _ _ | | 7 _ _ | _ 8 _ | 3 _ _ | | _ _ _ | 7 _ _ | _ _ _ | +-------+-------+-------+ | _ _ _ | _ _ _ | _ _ _ | | _ _ 9 | _ 1 _ | _ _ _ | | _ _ _ | _ _ 7 | _ _ _ | +-------+-------+-------+ | _ _ 1 | _ _ 8 | _ 2 _ | | _ _ _ | _ 2 6 | _ _ 1 | | _ _ _ | 3 _ 5 | _ _ _ | +-------+-------+-------+ The 4 problems we've been given (the orignal with the quiz and the 3 new ones seemed to yield fairly quickly. I'm looking forward to see other solutions and try them on this one. Here's the results of running the 1st 4. Vance heron-linux:for i in rqi* ; do time sd2.rb $i ; done Input +-------+-------+-------+ | _ 6 _ | 1 _ 4 | _ 5 _ | | _ _ 8 | 3 _ 5 | 6 _ _ | | 2 _ _ | _ _ _ | _ _ 1 | +-------+-------+-------+ | 8 _ _ | 4 _ 7 | _ _ 6 | | _ _ 6 | _ _ _ | 3 _ _ | | 7 _ _ | 9 _ 1 | _ _ 4 | +-------+-------+-------+ | 5 _ _ | _ _ _ | _ _ 2 | | _ _ 7 | 2 _ 6 | 9 _ _ | | _ 4 _ | 5 _ 8 | _ 7 _ | +-------+-------+-------+ Solution +-------+-------+-------+ | 9 6 3 | 1 7 4 | 2 5 8 | | 1 7 8 | 3 2 5 | 6 4 9 | | 2 5 4 | 6 8 9 | 7 3 1 | +-------+-------+-------+ | 8 2 1 | 4 3 7 | 5 9 6 | | 4 9 6 | 8 5 2 | 3 1 7 | | 7 3 5 | 9 6 1 | 8 2 4 | +-------+-------+-------+ | 5 8 9 | 7 1 3 | 4 6 2 | | 3 1 7 | 2 4 6 | 9 8 5 | | 6 4 2 | 5 9 8 | 1 7 3 | +-------+-------+-------+ real 0m0.060s user 0m0.050s sys 0m0.000s Input +-------+-------+-------+ | _ _ 2 | _ _ 5 | _ 7 9 | | 1 _ 5 | _ _ 3 | _ _ _ | | _ _ _ | _ _ _ | 6 _ _ | +-------+-------+-------+ | _ 1 _ | 4 _ _ | 9 _ _ | | _ 9 _ | _ _ _ | _ 8 _ | | _ _ 4 | _ _ 9 | _ 1 _ | +-------+-------+-------+ | _ _ 9 | _ _ _ | _ _ _ | | _ _ _ | 1 _ _ | 3 _ 6 | | 6 8 _ | 3 _ _ | 4 _ _ | +-------+-------+-------+ Solution +-------+-------+-------+ | 3 6 2 | 8 4 5 | 1 7 9 | | 1 7 5 | 9 6 3 | 2 4 8 | | 9 4 8 | 2 1 7 | 6 3 5 | +-------+-------+-------+ | 7 1 3 | 4 5 8 | 9 6 2 | | 2 9 6 | 7 3 1 | 5 8 4 | | 8 5 4 | 6 2 9 | 7 1 3 | +-------+-------+-------+ | 4 3 9 | 5 7 6 | 8 2 1 | | 5 2 7 | 1 8 4 | 3 9 6 | | 6 8 1 | 3 9 2 | 4 5 7 | +-------+-------+-------+ real 0m1.626s user 0m0.830s sys 0m0.010s Input +-------+-------+-------+ | _ _ _ | _ 7 _ | 9 4 _ | | _ 7 _ | _ 9 _ | _ _ 5 | | 3 _ _ | _ _ 5 | _ 7 _ | +-------+-------+-------+ | _ 8 7 | 4 _ _ | 1 _ _ | | 4 6 3 | _ 8 _ | _ _ _ | | _ _ _ | _ _ 7 | _ 8 _ | +-------+-------+-------+ | 8 _ _ | 7 _ _ | _ _ _ | | 7 _ _ | _ _ _ | _ 2 8 | | _ 5 _ | 2 6 8 | _ _ _ | +-------+-------+-------+ Solution +-------+-------+-------+ | 2 1 5 | 8 7 6 | 9 4 3 | | 6 7 8 | 3 9 4 | 2 1 5 | | 3 4 9 | 1 2 5 | 8 7 6 | +-------+-------+-------+ | 5 8 7 | 4 3 2 | 1 6 9 | | 4 6 3 | 9 8 1 | 7 5 2 | | 1 9 2 | 6 5 7 | 3 8 4 | +-------+-------+-------+ | 8 2 6 | 7 4 3 | 5 9 1 | | 7 3 4 | 5 1 9 | 6 2 8 | | 9 5 1 | 2 6 8 | 4 3 7 | +-------+-------+-------+ real 0m0.960s user 0m0.450s sys 0m0.000s Input +-------+-------+-------+ | _ _ 1 | _ 2 _ | 8 _ _ | | _ 7 _ | 3 1 _ | _ 9 _ | | 3 _ _ | _ 4 5 | _ _ 7 | +-------+-------+-------+ | _ 9 _ | 7 _ _ | 5 _ _ | | _ 4 2 | _ 5 _ | 1 3 _ | | _ _ 3 | _ _ 9 | _ 4 _ | +-------+-------+-------+ | 2 _ _ | 5 7 _ | _ _ 4 | | _ 3 _ | _ 9 1 | _ 6 _ | | _ _ 4 | _ _ _ | 3 _ _ | +-------+-------+-------+ Unsolvable +-------+-------+-------+ | 4 6 1 | 9 2 7 | 8 5 3 | | 8 7 5 | 3 1 6 | _ 9 2 | | 3 2 9 | 8 4 5 | 6 1 7 | +-------+-------+-------+ | _ 9 _ | 7 _ _ | 5 _ _ | | _ 4 2 | 6 5 8 | 1 3 9 | | _ _ 3 | _ _ 9 | _ 4 _ | +-------+-------+-------+ | 2 _ _ | 5 7 _ | 9 _ 4 | | _ 3 _ | _ 9 1 | _ 6 _ | | _ _ 4 | _ _ _ | 3 _ _ | +-------+-------+-------+ real 0m0.046s user 0m0.030s sys 0m0.010s On Sat, 2005-08-20 at 23:41 +0900, Karl von Laudermann wrote: > In article <15hhca6w53u5l.dlg / example.net>, > Chris Game <chrisgame / example.net> wrote: > > > Karl von Laudermann wrote: > > > > > Heh. I already wrote a Sudoku solver back in May; all I have to do > > > is change the input/output format a bit to match the quiz > > > example. In the meantime, here's a harder puzzle to test your > > > programs with: > > > > Why is it harder? If an algorithm works, all solvable puzzles are > > the same? > > Well, it's harder for a human to solve; I forget where I snagged it > from, but it was labelled as "really hard". And it took my solver > program a whole 7 seconds to solve it (on my old computer), while other > examples I tested it with took less than a second to solve. So it's > probably useful for profiling your program's performance. > > Ok, here's one that's *not* solvable, useful for making sure that your > program can handle such a case gracefully: > > +-------+-------+-------+ > | _ _ 1 | _ 2 _ | 8 _ _ | > | _ 7 _ | 3 1 _ | _ 9 _ | > | 3 _ _ | _ 4 5 | _ _ 7 | > +-------+-------+-------+ > | _ 9 _ | 7 _ _ | 5 _ _ | > | _ 4 2 | _ 5 _ | 1 3 _ | > | _ _ 3 | _ _ 9 | _ 4 _ | > +-------+-------+-------+ > | 2 _ _ | 5 7 _ | _ _ 4 | > | _ 3 _ | _ 9 1 | _ 6 _ | > | _ _ 4 | _ _ _ | 3 _ _ | > +-------+-------+-------+ >