From 21e8f4134f8d429ef95e1f52d06495d00d9e0f55 Mon Sep 17 00:00:00 2001 From: adrien Date: Sat, 23 Dec 2023 13:25:04 +0100 Subject: [PATCH] auto import --- classes.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) {