adventofcode/2016/day25/problem

85 lines
3.3 KiB
Plaintext
Raw Permalink Normal View History

2016-12-28 14:48:23 +00:00
Advent of Code
--- Day 25: Clock Signal ---
2018-03-15 16:24:23 +00:00
You open the door and find yourself on the roof. The city sprawls away from
you for miles and miles.
2016-12-28 14:48:23 +00:00
2018-03-15 16:24:23 +00:00
There's not much time now - it's already Christmas, but you're nowhere near
the North Pole, much too far to deliver these stars to the sleigh in time.
2016-12-28 14:48:23 +00:00
2018-03-15 16:24:23 +00:00
However, maybe the huge antenna up here can offer a solution. After all, the
sleigh doesn't need the stars, exactly; it needs the timing data they
provide, and you happen to have a massive signal generator right here.
2016-12-28 14:48:23 +00:00
2018-03-15 16:24:23 +00:00
You connect the stars you have to your prototype computer, connect that to
the antenna, and begin the transmission.
2016-12-28 14:48:23 +00:00
Nothing happens.
2018-03-15 16:24:23 +00:00
You call the service number printed on the side of the antenna and quickly
explain the situation. "I'm not sure what kind of equipment you have
connected over there," he says, "but you need a clock signal." You try to
explain that this is a signal for a clock.
2016-12-28 14:48:23 +00:00
2018-03-15 16:24:23 +00:00
"No, no, a clock signal - timing information so the antenna computer knows
how to read the data you're sending it. An endless, alternating pattern of
0, 1, 0, 1, 0, 1, 0, 1, 0, 1...." He trails off.
2016-12-28 14:48:23 +00:00
2018-03-15 16:24:23 +00:00
You ask if the antenna can handle a clock signal at the frequency you would
need to use for the data from the stars. "There's no way it can! The only
antenna we've installed capable of that is on top of a top-secret Easter
Bunny installation, and you're definitely not-" You hang up the phone.
2016-12-28 14:48:23 +00:00
2018-03-15 16:24:23 +00:00
You've extracted the antenna's clock signal generation assembunny code (your
puzzle input); it looks mostly compatible with code you worked on just
recently.
2016-12-28 14:48:23 +00:00
This antenna code, being a signal generator, uses one extra instruction:
2018-03-15 16:24:23 +00:00
 out x transmits x (either an integer or the value of a register) as the
next value for the clock signal.
2016-12-28 14:48:23 +00:00
2018-03-15 16:24:23 +00:00
The code takes a value (via register a) that describes the signal to
generate, but you're not sure how it's used. You'll have to find the input
to produce the right signal through experimentation.
2016-12-28 14:48:23 +00:00
2018-03-15 16:24:23 +00:00
What is the lowest positive integer that can be used to initialize register
a and cause the code to output a clock signal of 0, 1, 0, 1... repeating
forever?
2016-12-28 14:48:23 +00:00
2018-03-15 16:24:23 +00:00
Your puzzle answer was 175.
2016-12-28 14:48:23 +00:00
--- Part Two ---
2018-03-15 16:24:23 +00:00
The antenna is ready. Now, all you need is the fifty stars required to
generate the signal for the sleigh, but you don't have enough.
2016-12-28 14:48:23 +00:00
2018-03-15 16:24:23 +00:00
You look toward the sky in desperation... suddenly noticing that a lone star
has been installed at the top of the antenna! Only 49 more to go.
2016-12-28 14:48:23 +00:00
If you like, you can [ [Retransmit the Signal] ] .
Both parts of this puzzle are complete! They provide two gold stars: **
References
Visible links
. http://adventofcode.com/
. http://adventofcode.com/2016/about
. http://adventofcode.com/2016/support
. http://adventofcode.com/2016/events
. http://adventofcode.com/2016/settings
. http://adventofcode.com/2016/auth/logout
. http://adventofcode.com/2016
. http://adventofcode.com/2016
. http://adventofcode.com/2016/leaderboard
. http://adventofcode.com/2016/stats
. http://adventofcode.com/2016/sponsors
. http://adventofcode.com/2016/sponsors
. https://en.wikipedia.org/wiki/Clock_signal
. http://adventofcode.com/2016/day/12
. http://adventofcode.com/2016/day/23
. http://adventofcode.com/2016
. http://adventofcode.com/2016/day/25/input