Advent of code 2019 is a set of puzzles each day. Each day a new puzzle gets released and if the right answer is submited, part 2 is released.
I enjoy solving puzzles and use the puzzles every day to get better at programming and problem solving. This year I challenge myself using a programming language that I do not get to use during my (paid) job.
|Puzzle||Language||Part 1||Part 2|
|Day 1: The Tyranny of the Rocket Equation||Go||⭐️||⭐️|
|Day 2: 1202 Program Alarm||Go||⭐️||⭐️|
|Day 3: Crossed Wires|
|Day 4: Secure Container|
|Day 5: Sunny with a Chance of Asteroids|
|Day 6: Universal Orbit Map|
|Day 7: Amplification Circuit|
|Day 8: Space Image Format|
|Day 9: Sensor Boost|
|Day 10: Monitoring Station|
|Day 11: Space Police|
|Day 12: The N-Body Problem||Go|
|Day 13: Day 13: Care Package||Go|
Comment for each day solution
When I go along with the puzzles and solve them, I also make a short comment on each solution here. All the solutions is in my adventofcode2019 repositiory at Github.
For the first day I solved this by using the Go programming language. The first part was very simple and just reading some input and do a little calculation before adding it to a variable containing the sum for all the read inputs.
Part 2 was also simple, but had to add a little bit of recursion at each calculation.
This was a fun puzzle to solve, I have used the Go programming language in my solution. Part 1 on December 2th, was to make a program to read and do some operations in intcode. I did implement exactly what was needed for this task.
1,9,10,3, 2,3,11,0, 99, 30,40,50
Intcode is a string of integers that are separated with a comma. The first position (0) is the operation and the position 1 and 2 are for this definition the input and at position 3 is the output. The value at the position is a reference to where the value is located. In this first introduction to intcode, there are three operation. 1 = addition, 2 = multiplication and 99 = exit the program. In the example above, the first line is an addition of the number at position 9 and 10. The result should be placed at position 3 (30 + 40). In the given input file, the value at position 1 and 2 needed to be changed and it was mentioned in the description. At the first attempt, I forgot about that part.
The second part of the puzzle, it was given what the result should be at position 0. The only two positions that was allowed changed was position 1 and 2. Valid values was in the range 0 to 99. I did this the easy way with two loops and did check when I got the value I wanted in position 0. Complete solution is on Github.
In this third puzzle, there are two cables and should find out where they cross and calculate the Manhatten distance to find the crossing that is the closest to the central hub. For this puzzle, I will continuing using the Go programming language.
The concept of Advent of Code is cool, but I did not get the time to complete the days in December, so this is a nice set of puzzles to do throughout the year.