PHP Classes

No result

Recommend this page to a friend!

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

  1. No result   Reply   Report abuse  
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();

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?