@@ -88,14 +88,30 @@ |
||
88 | 88 | |
89 | 89 | $indexes = []; |
90 | 90 | |
91 | - if ($i > 0 && $j > 0) array_push($indexes, [$i - 1, $j - 1]); |
|
92 | - if ($i > 0) array_push($indexes, [$i - 1, $j]); |
|
93 | - if ($i > 0 && $j < sizeof($matrix[0]) - 1) array_push($indexes, [$i - 1, $j + 1]); |
|
94 | - if ($j > 0) array_push($indexes, [$i, $j - 1]); |
|
95 | - if ($j < sizeof($matrix[0]) - 1) array_push($indexes, [$i, $j + 1]); |
|
96 | - if ($i < sizeof($matrix) - 1 && $j > 0) array_push($indexes, [$i + 1, $j - 1]); |
|
97 | - if ($i < sizeof($matrix) - 1) array_push($indexes, [$i + 1, $j]); |
|
98 | - if ($i < sizeof($matrix) - 1 && $j < sizeof($matrix[0]) - 1) array_push($indexes, [$i + 1, $j + 1]); |
|
91 | + if ($i > 0 && $j > 0) { |
|
92 | + array_push($indexes, [$i - 1, $j - 1]); |
|
93 | + } |
|
94 | + if ($i > 0) { |
|
95 | + array_push($indexes, [$i - 1, $j]); |
|
96 | + } |
|
97 | + if ($i > 0 && $j < sizeof($matrix[0]) - 1) { |
|
98 | + array_push($indexes, [$i - 1, $j + 1]); |
|
99 | + } |
|
100 | + if ($j > 0) { |
|
101 | + array_push($indexes, [$i, $j - 1]); |
|
102 | + } |
|
103 | + if ($j < sizeof($matrix[0]) - 1) { |
|
104 | + array_push($indexes, [$i, $j + 1]); |
|
105 | + } |
|
106 | + if ($i < sizeof($matrix) - 1 && $j > 0) { |
|
107 | + array_push($indexes, [$i + 1, $j - 1]); |
|
108 | + } |
|
109 | + if ($i < sizeof($matrix) - 1) { |
|
110 | + array_push($indexes, [$i + 1, $j]); |
|
111 | + } |
|
112 | + if ($i < sizeof($matrix) - 1 && $j < sizeof($matrix[0]) - 1) { |
|
113 | + array_push($indexes, [$i + 1, $j + 1]); |
|
114 | + } |
|
99 | 115 | |
100 | 116 | return $indexes; |
101 | 117 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | $this->loadXML($filename); |
48 | 48 | |
49 | - if($outputFilename != null){ |
|
49 | + if ($outputFilename != null) { |
|
50 | 50 | $this->outputFilename = $outputFilename; |
51 | 51 | } |
52 | 52 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $this->life->start($verbose); |
90 | 90 | |
91 | 91 | if ($this->life->isEnded()) { |
92 | - self::createXMLfromCells("data/".$this->outputFilename, $this->organisms->getCells(), $this->species, $this->iterations); |
|
92 | + self::createXMLfromCells("data/" . $this->outputFilename, $this->organisms->getCells(), $this->species, $this->iterations); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | return true; |