• To celebrate the release of Halo: The Master Chief Collection on Steam, Xbox Games Studios has provided 5 Steam copies of the game and 5 Xbox One copies of the game! We will be giving these away in the Gaming Giveaways |OT|. Some Steam copies will also be given away to the PC Gaming Era community.
  • An old favorite feature returns: Q&ERA is back! This time we'll be collecting questions for Remedy Entertainment, makers of Max Payne, Alan Wake, Quantum Break, and Control. Members can submit questions for the next 4 days, 4 hours, 31 minutes, 33 seconds. Submissions will close on Dec 12, 2019 at 12:00 AM.

Advent of Code 2019...save Santa and Xmas with programming!

NumberThree

Avenger
Oct 27, 2017
2,145
I have just begun working on this and finished day 2. Is there any more elegant solution to the second part of day 2 other than just brute force loop through two lists? I kept wanting to do something smarter like adjusting both noun and verb individually up and down one depending on the result till it hit the solution... but that feels like a lot of effort đŸ™ˆ
Because the verb and noun indicate the address of the data that will be used, there won't be any relation between two consecutive values. I think for this one bruteforcing is the (only?) way to go.
 

NetMapel

Member
Oct 25, 2017
353
For day 3 part 1, I have a question to ask for clarification. I have written lines of codes that will check for intersections between wires. Now I am starting at a central port of (0, 0) and then extending the wires from there. I haven noticed for the first practice data set of:

R75,D30,R83,U83,L12,D49,R71,U7,L72
U62,R66,U55,R34,D71,R55,D58,R83
Given a (0, 0) starting point, there appears to be an intersection at (158, -12) which created a distance of 146. That's shorter than the accepted distance of 159. Are we to assume that the wires cannot go in the left or below the starting point? Given the example graphs they provided, it's not clear whether they are allowing the wire to go left/down the starting point. I do not believe I made a mistake coming up with the intersecting points given all the other test datas did not give me this problem. Is that also something you guys faced when doing day 3 part 1?
 

Randdalf

Member
Oct 28, 2017
1,652
For day 3 part 1, I have a question to ask for clarification. I have written lines of codes that will check for intersections between wires. Now I am starting at a central port of (0, 0) and then extending the wires from there. I haven noticed for the first practice data set of:



Given a (0, 0) starting point, there appears to be an intersection at (158, -12) which created a distance of 146. That's shorter than the accepted distance of 159. Are we to assume that the wires cannot go in the left or below the starting point? I do not believe I made a mistake coming up with the intersecting points given all the other test datas did not give me this problem. Is that also something you guys faced when doing day 3 part 1?
Your code for calculating Manhattan distance is wrong. That point is 170 from the central port.
 

iapetus

Member
Oct 26, 2017
1,573
I knew I should have written an interface for input/output to the IntCode interpreter to happen programmatically. Ah well, at least I left sensible hooks for one...
 

Randdalf

Member
Oct 28, 2017
1,652
Isn't your part two crazily overengineered?

Just make a list of planets from YOU and SAN up to the center point. Work from YOU towards the center - stop at the first value that's in the SAN list and add the indices of that item in the two lists together (and subtract two).
I rewrote my day 6 part 2 and it's way simpler now: https://github.com/Randdalf/aoc19/blob/master/d06.py

I ended up with something similar to what you described.

I tried two ways of finding the path: inverting my orbits dictionary then working backwards, and recursive DFS. The latter seems just as fast and is less code, so it won out for me.
 

NetMapel

Member
Oct 25, 2017
353
Your code for calculating Manhattan distance is wrong. That point is 170 from the central port.
My abomination took a bit of time to calculate the Manhattan distance from the real data set but it worked :O Now I just need to optimize it... but scanning part B's problem set makes me think my current set up is best suited to tackle that lol
 
OP
OP
ElFly

ElFly

Member
Oct 27, 2017
957
did day 7 part a, may do part b later cause it sounds complex

even part a was complex to figure out. had skipped a rule and gotten v wrong answers

edit: did part b. It was hard

in the end I was sharing state between the _amplifiers_ cause I had not properly copied the array of the state, just a reference somehow

after that I had to put a try / except in the code cause some of the inputs caused out of bounds index reads. Then finally got it right

woop woop!
 
Last edited:

Qronicle

Member
Oct 27, 2017
169
Belgium
Fuck me, I'm stuck on part 2 :-/

So I'm having a big while loop until one of the thrusters ends his intcode application. I have different intcode instances for each of the thrusters, and whenever a thruster asks for input that isn't available, that thruster pauses execution, and I pass the last given output as input to the next one. Whenever I'm in the second feedback loop, I just continue from the address that asked for input with the last output. So either my logic is wrong, or I have made a mistake somewhere.

Does anybody have some output to compare for the first example? (Input: 3,26,1001,26,-4,26,3,27,1002,27,2,27,1,27,26,27,4,27,1001,28,-1,28,1005,28,6,99,0,0,5)

Engine 0 - phase 9
> Input: 9, 0
> Demands more input
Engine 1 - phase 8
> Input: 8, 5
> Demands more input
Engine 2 - phase 7
> Input: 7, 14
> Demands more input
Engine 3 - phase 6
> Input: 6, 31
> Demands more input
Engine 4 - phase 5
> Input: 5, 64
> Demands more input
> Output: 129
Engine 0 - phase 9
> Input: 129
> Demands more input
Engine 1 - phase 8
> Input: 263
> Demands more input
Engine 2 - phase 7
> Input: 530
> Demands more input
Engine 3 - phase 6
> Input: 1063
> Demands more input
Engine 4 - phase 5
> Input: 2128
> Demands more input
> Output: 4257
Engine 0 - phase 9
> Input: 4257
> Demands more input
Engine 1 - phase 8
> Input: 8519
> Demands more input
Engine 2 - phase 7
> Input: 17042
> Demands more input
Engine 3 - phase 6
> Input: 34087
> Demands more input
Engine 4 - phase 5
> Input: 68176
> Demands more input
> Output: 136353
Engine 0 - phase 9
> Input: 136353
> Demands more input
Engine 1 - phase 8
> Input: 272711
> Demands more input
Engine 2 - phase 7
> Input: 545426
> Demands more input
Engine 3 - phase 6
> Input: 1090855
> Demands more input
Engine 4 - phase 5
> Input: 2181712
> Demands more input
> Output: 4363425
Engine 0 - phase 9
> Input: 4363425
> End
 

gryvan

Member
Oct 25, 2017
356
I definitely would like more practice in my problem solving skills as well as my coding skills so I'll see how this goes!
 
Last edited:

iapetus

Member
Oct 26, 2017
1,573
Well, I'm tired so my code for part 2 is an embarrassing multithreaded mess. Five amplifiers running in parallel with input/output queues between them. Nobody can be allowed to see the source and live, but at least it worked.