Fix bugs/typos

This commit is contained in:
Dennis Eichhorn 2019-09-04 20:39:29 +02:00
parent bebfbafae8
commit c9e439c0f4
2 changed files with 5 additions and 5 deletions

View File

@ -41,7 +41,7 @@ class JumpPointSearch implements PathFinderInterface
$startNode->setF(0.0);
$startNode->setOpened(true);
$openList = new Heap(function($node1, $node2) { return $node1->getF() - $nodeB->getF(); });
$openList = new Heap(function($node1, $node2) { return $node1->getF() - $node2->getF(); });
$openList->push($startNode);
$node = null;
@ -72,7 +72,7 @@ class JumpPointSearch implements PathFinderInterface
if (!$neighbor->isOpened()) {
$openList->push($neighbor);
$jumpPoint->setOpened(true);
$neighbor->setOpened(true);
} else {
$openList->update($neighbor);
}

View File

@ -27,7 +27,7 @@ class Path
public array $nodes = [];
private float $weight = 0.0;
private float $distance = 0.0;
private ?Grid $grid = null;
private Grid $grid;
public function __construct(Grid $grid)
{
@ -42,7 +42,7 @@ class Path
public function expandPath() : array
{
$reverse = \array_reverse($this->nodes);
$length = count($reverse);
$length = \count($reverse);
if ($length < 2) {
return $reverse;
@ -54,7 +54,7 @@ class Path
$coord1 = $reverse[$i + 1];
$interpolated = $this->interpolate($coord0, $coord1);
$iLength = count($interpolated);
$iLength = \count($interpolated);
$expanded = \array_merge($expanded, \array_slice($interpolated, 0, $iLength - 1));
}