Beispiel #1
0
 public function __invoke()
 {
     $elevator = new Elevator();
     $parser = new InstructionParser($elevator);
     $floorObserver = new FloorObserver($parser);
     $elevator->attach($floorObserver);
     $parser->parseInstructions(file_get_contents(__DIR__ . '/../../input/day1.txt'));
     echo 'Position of the character that causes Santa to first enter the basement : ' . $floorObserver->getInstructionPosition() . "\n\n";
 }
Beispiel #2
0
 public function __invoke()
 {
     $elevator = new Elevator();
     $parser = new InstructionParser($elevator);
     $observer = new FloorObserver($parser);
     $elevator->attach($observer);
     $input = file_get_contents(__DIR__ . '/../../input/Day1/input.txt');
     $parser->parseInstructions($input);
     echo "We went into the basement at instruction: " . $observer->getInstructionNumber() . "\n\n";
 }