From: Karl von Laudermann Date: 2005-08-20T23:41:17+09:00 Subject: Re: [QUIZ] Sodoku Solver (#43) In article <15hhca6w53u5l.dlg@example.net>, Chris Game 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 _ _ | +-------+-------+-------+ -- Karl von Laudermann - karlvonl(a)rcn.com - http://www.geocities.com/~karlvonl #!/usr/bin/env ruby require "complex";w=39;m=2.0;w.times{|y|w.times{|x|c=Complex.new((m*x/w)-1.5, (2.0*y/w)-1.0);z=c;e=false;49.times{z=z*z+c;if z.abs>m then e=true;break;end} print(e ?" ":"@@");puts if x==w-1;}}