Exemplo n.º 1
0
 public function __invoke()
 {
     $elevator = new Elevator();
     $parser = new InstructionParser($elevator);
     $parser->parseInstructions(file_get_contents(__DIR__ . '/../../input/day1.txt'));
     echo 'Final floor : ' . $elevator->getFloor() . "\n\n";
 }
Exemplo n.º 2
0
 public function __invoke()
 {
     $instructions = file_get_contents(__DIR__ . '/../../input/Day1/input.txt');
     $elevator = new Elevator();
     $parser = new InstructionParser($elevator);
     $parser->parseInstructions($instructions);
     echo "Final floor: " . $elevator->getFloor() . "\n\n";
 }
Exemplo n.º 3
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";
 }
Exemplo n.º 4
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";
 }