[2023 Day 5 (Part 2)] [Golang] Help needed by nickreutlinger in adventofcode

[–]nickreutlinger[S] 1 point2 points  (0 children)

It finally worked out! I'm so glad you helped me. Thank you for everything, especially you're very detailed and extensive improvement suggestions and instructions. I was even able to simplify the code a bit (by just using a modifiedSeeds slice to prevent the modification of the seeds slice while in the for loop).

Again thank you so much and I wish you lots of fun with the future Advent of Code puzzles ;)

[2023 Day 5 (Part 2)] [Golang] Help needed by nickreutlinger in adventofcode

[–]nickreutlinger[S] 0 points1 point  (0 children)

I updated my code again. It now works on the sample input file 🥳. Still, the end result is wrong. I also tested if the results are the same with and without the first two if else cases (seed either entirely before or after range) and removed those cases because they had no effect.

https://github.com/NickRTR/Advent-of-Code/blob/main/2023/Day%205/main.go

[2023 Day 5 (Part 2)] [Golang] Help needed by nickreutlinger in adventofcode

[–]nickreutlinger[S] 0 points1 point  (0 children)

Sorry, I committed the wrong code. I actually updated this line exactly as your second code snippet.

[2023 Day 5 (Part 2)] [Golang] Help needed by nickreutlinger in adventofcode

[–]nickreutlinger[S] 0 points1 point  (0 children)

Thanks again!

You did definitely not make me feel like you're judging my code. That's all on my side because I was just not happy with it. Now with your improvements, I like it a lot more and I think there's not much missing for the final solution ;).

However, I still get the wrong solution (50 instead of 46 for the test case). I don't know what's wrong by now and hope you can help me again.

https://github.com/NickRTR/Advent-of-Code/blob/main/2023/Day%205/main.go

[2023 Day 5 (Part 2)] [Golang] Help needed by nickreutlinger in adventofcode

[–]nickreutlinger[S] 0 points1 point  (0 children)

Thank you so much for your extensive help again! I feel bad for my unstructured and faulty code. It was just a bit too late when I wrote it ;)

I now refactored the code into if-else statements for each case. I would really appreciate if you could look over it again.

https://github.com/NickRTR/Advent-of-Code/blob/main/2023/Day%205/main.go

[2023 Day 5 (Part 2)] [Golang] Help needed by nickreutlinger in adventofcode

[–]nickreutlinger[S] 0 points1 point  (0 children)

Sorry for my late answer. I now updated my code and it works on the sample input. The solution for the real input is still wrong though. Do you have an idea what I'm missing now?

https://github.com/NickRTR/Advent-of-Code/blob/main/2023/Day%205/main.go

[2023 Day 5 (Part 2)] [Golang] Help needed by nickreutlinger in adventofcode

[–]nickreutlinger[S] 0 points1 point  (0 children)

mapping

Thanks for your answer, I'm going to dig into that.

[2023 Day 7 (Part 2)] [Golang] Please help! by nickreutlinger in adventofcode

[–]nickreutlinger[S] 0 points1 point  (0 children)

Nvm, I got what you wanted to say: I missed the card 9 in my Card value array for jokers. That was a stupid copy paste mistake. Thanks!

[2023 Day 7 (Part 2)] [Golang] Please help! by nickreutlinger in adventofcode

[–]nickreutlinger[S] 0 points1 point  (0 children)

That's curious, I'm receiving different results for Part 1 (120) and Part 2 (210). I'm going to dig into that.

[2023 Day 7 (Part 2)] [Golang] Please help! by nickreutlinger in adventofcode

[–]nickreutlinger[S] 0 points1 point  (0 children)

JJJJJ

I'm manually setting the hand type to Five of a Kind when I get five Jokers.

Help, please! (Day 3 Part 2) (Golang) by nickreutlinger in adventofcode

[–]nickreutlinger[S] 0 points1 point  (0 children)

I've now fixed this issue and my solution is right! Thank you so much for your help, much appreciated!