Exemple #1
0
<?php

$day6 = new Day6();
$fp = fopen('../input/input6.txt', 'r');
while ($line = trim(fgets($fp))) {
    $day6->parse($line);
}
echo $day6->count() . PHP_EOL;
class Day6
{
    private $_lights = array();
    /**
     * Set up the array
     */
    public function __construct()
    {
        for ($i = 0; $i < 1000; $i++) {
            for ($j = 0; $j < 1000; $j++) {
                $this->_lights[$i][$j] = 0;
            }
        }
        self::_debug('initialized');
    }
    /**
     * Switch a light on
     *
     * If it is already on, nothing will change.
     *
     * @param int $x The x position of the light
     * @param int $y The y position of the light
     */
Exemple #2
0
 /**
  * @test
  * @param string $input
  * @param int $expected
  * @dataProvider getTestIsStringNiceTestData
  */
 public function testIsStringNice(\string $input, \int $expected)
 {
     $result = $this->Day6->solveFirst($input);
     $this->assertEquals($expected, $result, $input);
 }