WWW.RIDESIDE.NET

home | about | tracker | comics

throwing shoes since '04
Posted by tgl on 2005-12-08 13:13:32 +0000

sudoku

'; print ' '; print ' '; print '

'; $stimer = explode( ' ', microtime() ); $stimer = $stimer[1] + $stimer[0]; function check(&$grid, $ii, $jj, $value) { if (0 == $value) { return false; } for ($kk = 0; $kk < 9; $kk++) { if ($value == $grid[$ii][$kk]) { return false; } } for ($kk = 0; $kk < 9; $kk++) { if ($value == $grid[$kk][$jj]) { return false; } } $cell = array(); $ith = 3*floor(($ii) / 3); $jth = 3*floor(($jj) / 3); for ($i = $ith; $i < $ith + 3; $i++) { for ($j = $jth; $j < $jth + 3; $j++) { array_push($cell, $grid[$i][$j]); } } for ($i = 0; $i < sizeof($cell); $i++) { if ($value == $cell[$i]) { return false; } } return true; } $checks = array(); $grid = array(); for ($ii = 0; $ii < 9; $ii++) { array_push($checks, array(0, 0, 0, 0, 0, 0, 0, 0, 0)); array_push($grid, array(0, 0, 0, 0, 0, 0, 0, 0, 0)); } for ($ii = 0; $ii < 9; $ii++) { $jcheck = 0; for ($jj = 0; $jj < 9; $jj++) { srand((double)microtime()*1000000); $try = rand(1,9); while (!check($grid, $ii, $jj, $try)) { while ($checks[$ii][$jj] == 8) { $grid[$ii][$jj] = 0; if (0 == $jj) { if (0 == $ii) { for ($i = 0; $i < 9; $i++) { for ($j = 0; $j < 9; $j++) { $checks[$i][$j] = 0; } } } else { $ii--; $jj = 8; } } else { $jj--; } $try = $grid[$ii][$jj]; $try++; } if ($try > 8) { $try = 1; } else { $try++; } $checks[$ii][$jj]++; if ('chance' == $type && $checks[$ii][$jj] == 8) { break 2; } } $grid[$ii][$jj] = $try; } } $output = "\n"; for ($ii = 0; $ii < 9; $ii++) { $output .= " \n"; for ($jj = 0; $jj < 9; $jj++) { $output .= " \n"; } $output .= " \n"; } $output .= "
" . $grid[$ii][$jj] . "
\n"; print $output; $etimer = explode( ' ', microtime() ); $etimer = $etimer[1] + $etimer[0]; printf( "

%f seconds.", ($etimer-$stimer) ); if ('make' == $type) { print '
'; print 'Optimization, anyone?'; } ?>

Posted by dawnbixtler on 2005-12-08 03:50:49 +0000
It's generating them? Can we do them?

Posted by tgl on 2005-12-08 12:43:43 +0000
Yes. That's the goal.

Posted by rladew on 2005-12-08 14:14:15 +0000
are there 12 step Sudoku support groups? you know you have a Sudoku Problem when _____. _______________________________ I can't understand why people are frightened of new ideas. I'm frightened of the old ones. -John Cage

Posted by rladew on 2005-12-08 17:14:00 +0000
Is this 'under development'? these puzzles dont make sense to me... _______________________________ I can't understand why people are frightened of new ideas. I'm frightened of the old ones. -John Cage

Posted by tgl on 2005-12-23 18:26:47 +0000
How are these generally setup, a random number are blank? A set number are set blank randomly? Or is there an art to blanking, which is why Will Shortz edits these things?

Posted by dawnbixtler on 2005-12-26 17:55:59 +0000
Very much an art to "blanking". They should be quadremical, like cross word puzzles. In fact, the ones rs.n is generating are extremely difficult, if even possible. I haven't tried fully though.

Posted by tgl on 2005-12-27 13:44:04 +0000
My question concerned the blanking (rs.n does not create sudoku with blanks, the ones filled with zeros are impossible, does anyone care to figure out the possibility of correctly "discovering" a sudoku with random number selection along the grid?). So, even if the blanks were computed in an artful way, the underlying puzzle might still be un-appealing?

Posted by Miriam on 2006-03-09 17:03:18 +0000
I still don't understand how this page works. Do I have to print it out? Can I work on it online? HELP!

Posted by tgl on 2006-03-09 18:03:12 +0000
You'd have to print it out. Make sure you select "Make one" before doing so.

E-mail to tgl@rideside.net to add your tumblr.
Find me on github.