Esempio n. 1
0
 public function convertToSyntaxWithPath(NodeGrid $grid, NodePath $path)
 {
     $syntax = '';
     $nodes = $grid->getNodes();
     foreach ($nodes as $line) {
         foreach ($line as $node) {
             if (!$node->isWalkable()) {
                 $syntax .= self::WALL;
             } elseif ($node->toString() == $path->getStartNode()->toString()) {
                 $syntax .= self::IN;
             } elseif ($node->toString() == $path->getEndNode()->toString()) {
                 $syntax .= self::OUT;
             } elseif ($path->contains($node)) {
                 $syntax .= self::STEP;
             } else {
                 $syntax .= self::FREE;
             }
         }
         $syntax .= "\n";
     }
     return $syntax;
 }
Esempio n. 2
0
 private function assertSamePath(array $a, array $b)
 {
     $aPath = new NodePath($a);
     $bPath = new NodePath($b);
     $this->assertSame($aPath->toString(), $bPath->toString());
 }