-
Notifications
You must be signed in to change notification settings - Fork 0
/
dayTemplate.php
45 lines (39 loc) · 1.19 KB
/
dayTemplate.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
require_once './AbstractBenchmarking.php';
class Day extends AbstractBenchmarking
{
private array $data;
private array $testData;
private string $rawData;
private string $rawTestData;
public function __construct()
{
$this->rawData = file_get_contents('Data/day.txt');
$this->rawTestData = file_get_contents('TestData/day.txt');
$this->parseData(true);
$this->parseData();
}
public function parseData(bool $test = false): void
{
$rawInputData = $test ? $this->rawTestData : $this->rawData;
foreach (explode(PHP_EOL, $rawInputData) as $value) {
preg_match('/(\d+)$/', $value, $matches);
$lineInput = array_map('intval', array_slice($matches, 1, 4));
if ($test) {
$this->testData[] = $lineInput;
} else {
$this->data[] = $lineInput;
}
}
}
public function part1(bool $test = false): int
{
$inputData = $test ? $this->testData : $this->data;
return 0;
}
public function part2(bool $test = false): int
{
$inputData = $test ? $this->testData : $this->data;
return 0;
}
}