auto import

This commit is contained in:
Adrien MALINGREY 2023-12-23 13:25:04 +01:00
parent 31a40a7e93
commit 21e8f4134f

View File

@ -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) {