Login   Register  
PHP Classes
elePHPant
Icontem

No result

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      Sudoku  >  All threads  >  No result  >  (Un) Subscribe thread alerts  
Subject:No result
Summary:Often times it will fail to generate a puzzle.
Messages:1
Author:Andrew Henninger
Date:2007-08-29 17:00:27
 

  1. No result   Reply  
Picture of Andrew Henninger
Andrew Henninger
2007-08-29 17:00:27
I've been generating puzzles using the code from Example2.php:

$p = new Sudoku();
$theInitialPosition = $p->generatePuzzle();
$i = new Sudoku();
$i->initializePuzzleFromArray($theInitialPosition);
$i->printSolution();
$p->printSolution();

And often, it will return a blank puzzle.

I put it in a loop like this:

do {
$theInitialPosition = $p->generatePuzzle($level, 50, 10);
} while (strlen(trim($p->getBoardAsString())) == 0);

but this will exceed the 30 second timeout my server has in place.

Is there something I could be doing wrong or is this to be expected?