コード例 #1
0
ファイル: Test.php プロジェクト: roukmoute/Advent-of-Code
 public function testEnterTheBasementAtCharacterPositionFive()
 {
     $this->day1->activeTheFirstPositionToEnterTheBasement();
     $this->day1->stringOfParenthesis('()())');
     $this->assertEquals(5, $this->day1->getPositionToEnterTheBasement());
 }
コード例 #2
0
ファイル: index.php プロジェクト: Helfull/Advent-of-code
<?php

require __DIR__ . '/vendor/autoload.php';
$formatter = new DayFormatter();
echo "\r\n";
echo "\r\n";
$dayOne = new Day1();
$data = file_get_contents('./inputs/Day1');
echo $formatter->display('DayOne', ['Floor' => $dayOne->move($data), 'Position' => $dayOne->position($data)]);
$dayTwo = new Day2();
$data = file_get_contents('./inputs/Day2');
echo $formatter->display('DayTwo', ['Paper' => $dayTwo->present($data), 'Ribbon' => $dayTwo->ribbon($data)]);
$dayThree = new Day3();
$data = file_get_contents('./inputs/Day3');
echo $formatter->display('DayThree', ['Houses' => $dayThree->moves($data), 'Houses with Robo' => $dayThree->movesWithRobo($data)]);
$dayFour = new Day4();
$data = file_get_contents('./inputs/Day4');
/*$hashDataPart1 = $dayFour->hash($data);
$hashDataPart2 = $dayFour->hash($data, '000000');*/
echo $formatter->display('DayFour', ['Part One MD5 Hash' => "0000045c5e2b3911eb937d9d8c574f09", 'Part One Number' => 346386, 'Part Two MD5 Hash' => "00000094434e1914548b3a1af245fb27", 'Part Two Number' => 9958218]);
$dayFive = new Day5();
$data = file_get_contents('./inputs/Day5');
$result = $dayFive->checkWords($data, "\r\n");
$result2 = $dayFive->checkWords($data, "\r\n", true);
echo $formatter->display('DayFive', ['Nice Words count: ' => $result, 'Nice Words count (improved): ' => $result2]);
$daySix = new Day6();
$data = file('./inputs/Day6');
/*$result = $daySix->run($data);
$daySix->reset();
$result2 = $daySix->run($data, true);*/
echo $formatter->display('DaySix', ['Lights lit: ' => 569999, 'Lights lit (correct): ' => 17836115]);
コード例 #3
0
ファイル: Day1Test.php プロジェクト: mattsches/AdventOfCode
 /**
  * @test
  * @param string $input
  * @param int $expected
  * @dataProvider getTestGetBasementPositionTestData
  */
 public function testGetBasementPosition(\string $input, \int $expected)
 {
     $result = $this->day1->getBasementPosition($input);
     $this->assertEquals($expected, $result);
 }