diff --git a/classes.php b/classes.php index 722b2ae..8372a13 100644 --- a/classes.php +++ b/classes.php @@ -48,7 +48,7 @@ } class Grid { - function __construct() { + function __construct($gridStr="") { $this->boxes = array(); $this->rows = array_fill(0, 9, array()); $this->columns = array_fill(0, 9, array()); @@ -74,6 +74,12 @@ if ($box != $neighbour && !in_array($neighbour, $box->neighbourhood)) $box->neighbourhood[] = $neighbour; } + + if ($gridStr) { + $this->import($gridStr); + } else { + $this->generate(); + } } function import($gridStr) {