Advent of Code - Day 6

coding-challenge
2018
advent-of-code
#21

Crosscheck, my code does return 5508 for your input. Is this close to your answer?

0 Likes

#22

3251 got accepted. Thanks. Will go through the code. BTW are you the creator of wings3d ! Awesome !

1 Like

#23

PS: I know what the error might be in my code.

I do not treat this situation correctly: Aa.bB. My code will assign the . to A, as it was the first in the input. The examples though tell us, to not assign those at all.

0 Likes

#24

Yes, I am, but nowadays dgud and Micheus do most of the maintance and development of new features.

1 Like

#25

Ok, thanks for the update. Will keep it in mind while going through your code. :+1:

0 Likes

#26

I quickly modified my code to print the first N largest areas, and I see that 3251 is the fourth largest one, so I’m pretty certain that my bug is that I include some infinite regions in the output. It appears that my approach for picking non-infinite regions is too naive. I pick all the input coordinates which are inside the bounding box (max/min x/y coordinates), which is definitely wrong. Since you got the same wrong output, maybe your version suffers from the same problem? I’ll fix my solution in the next few days.

0 Likes

#27

Thanks, looking forward to it!

0 Likes

#28

I got 3251 with my code so if you want to look at an inelegant solution feel free!

0 Likes

#29

I fixed this bug and now have 3251 as a result with @theshank’s input as well.

0 Likes

#30

Thanks, I will check it out asap.

0 Likes

#31

@simon I dont know about the elegance of your solution, in terms of the algorithm used (since i havent gone throught it yet), but when it comes to readability, your code appears to be readable, despite the long functions. Thanks for sharing, I will go through it asap.

1 Like

#32

I pushed the fix for my solution. As I suspected, the algorithm for identifying infinite regions was wrong, so in some situations my code included some infinite regions when looking for the maximum one. The new version now returns 3251 for your input, while the result for my input remains unchanged. I guess I was lucky here to get an input which didn’t trigger the bug in my code.

2 Likes

#33

Thanks, I will go through it.

0 Likes

#34

Super readable code ! Thanks for sharing !

1 Like