Module aoc::y15d18

source ·
Expand description

Advent of Code 2015 Day 18: https://adventofcode.com/2015/day/18

A relatively easy challenge, we essentially keep track of all of the lights as points on a grid (std::collections::HashMap) and then for each step evaluate the neighbors to build a new grid and then replace the current grid with the new grid in order to make one atomic option. Lights on the edge should have their neighbors considered off which is easy with the HashMap lookup: if we don’t have a neighbor because it doesn’t exist in the grid then don’t increment the turned-on-neighbor count. In part two we just continually always set the corners to on.

Functions§

  • The solution for the day eighteen challenge.