From e1f10bb82f84877cbeb36bd801929f64669ebb88 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 16 Dec 2019 20:44:47 +0100 Subject: [PATCH] add possible improvement remarks --- Algorithm/Maze/MazeGenerator.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Algorithm/Maze/MazeGenerator.php b/Algorithm/Maze/MazeGenerator.php index af8a1bc36..2d3a6bd89 100644 --- a/Algorithm/Maze/MazeGenerator.php +++ b/Algorithm/Maze/MazeGenerator.php @@ -109,27 +109,27 @@ class MazeGenerator if ($i % 2 === 0) { for ($j = 0; $j < $width * 4 + 1; ++$j) { if ($j % 4 === 0) { - $line[$j] = '+'; + $line[$j] = '+'; // 9 } else { - $line[$j] = $i > 0 && ($vertical[$i / 2 - 1][(int) \floor($j / 4)] ?? false) ? ' ' : '-'; + $line[$j] = $i > 0 && ($vertical[$i / 2 - 1][(int) \floor($j / 4)] ?? false) ? ' ' : '-'; // 9 } } } else { - for ($j = 0; $j < $width * 4 + 1; ++$j) { + for ($j = 0; $j < $width * 4 + 1; ++$j) { // 2 if ($j % 4 === 0) { - $line[$j] = $j > 0 && ($horizontal[($i - 1) / 2][$j / 4 - 1] ?? false) ? ' ' : '|'; + $line[$j] = $j > 0 && ($horizontal[($i - 1) / 2][$j / 4 - 1] ?? false) ? ' ' : '|'; // 0 | 9 } else { - $line[$j] = ' '; + $line[$j] = ' '; // 0 } } } if ($i === 0) { - $line[1] = $line[2] = $line[3] = ' '; + $line[1] = $line[2] = $line[3] = ' '; // 0 } if ($height * 2 - 1 === $i) { - $line[4 * $width] = ' '; + $line[4 * $width] = ' '; // 2 - 0 } $maze[] = $line;