예제 #1
0
파일: day6.php 프로젝트: Sigafoos/advent
<?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
     */