aoc-2018-python

Advent of Code 2018 Solutions in Python
git clone https://git.sinitax.com/sinitax/aoc-2018-python
Log | Files | Refs | README | sfeed.txt

part1 (2456B)


      1--- Day 1: Chronal Calibration ---
      2
      3"We've detected some temporal anomalies," one of Santa's Elves at the Temporal Anomaly Research and
      4Detection Instrument Station tells you. She sounded pretty worried when she called you down here.
      5"At 500-year intervals into the past, someone has been changing Santa's history!"
      6
      7"The good news is that the changes won't propagate to our time stream for another 25 days, and we
      8have a device" - she attaches something to your wrist - "that will let you fix the changes with no
      9such propagation delay. It's configured to send you 500 years further into the past every few days;
     10that was the best we could do on such short notice."
     11
     12"The bad news is that we are detecting roughly fifty anomalies throughout time; the device will
     13indicate fixed anomalies with stars. The other bad news is that we only have one device and you're
     14the best person for the job! Good lu--" She taps a button on the device and you suddenly feel like
     15you're falling. To save Christmas, you need to get all fifty stars by December 25th.
     16
     17Collect stars by solving puzzles.  Two puzzles will be made available on each day in the Advent
     18calendar; the second puzzle is unlocked when you complete the first.  Each puzzle grants
     19one star. Good luck!
     20
     21After feeling like you've been falling for a few minutes, you look at the device's tiny screen.
     22"Error: Device must be calibrated before first use. Frequency drift detected. Cannot maintain
     23destination lock." Below the message, the device shows a sequence of changes in frequency (your
     24puzzle input). A value like +6 means the current frequency increases by 6; a value like -3 means the
     25current frequency decreases by 3.
     26
     27For example, if the device displays frequency changes of +1, -2, +3, +1, then starting from a
     28frequency of zero, the following changes would occur:
     29
     30
     31 - Current frequency  0, change of +1; resulting frequency  1.
     32
     33 - Current frequency  1, change of -2; resulting frequency -1.
     34
     35 - Current frequency -1, change of +3; resulting frequency  2.
     36
     37 - Current frequency  2, change of +1; resulting frequency  3.
     38
     39
     40In this example, the resulting frequency is 3.
     41
     42Here are other example situations:
     43
     44
     45 - +1, +1, +1 results in  3
     46
     47 - +1, +1, -2 results in  0
     48
     49 - -1, -2, -3 results in -6
     50
     51
     52Starting with a frequency of zero, what is the resulting frequency after all of the changes in
     53frequency have been applied?
     54
     55