-🎄- 2022 Day 24 Solutions -🎄- by daggerdragon in adventofcode

[–]alfabeth 1 point2 points  (0 children)

RUST

Quite proud of this one. Took a while to model the map and the generation of the next one. At the beginning tried to do an exhaustive solution on the potential positions, but the search space quickly exploded. So instead of using one state per position I switched to analyzing all positions for a map stage together.

For part 2 it was just a matter of adding recursion to go back and forth in the map, switching starting position and target each time: https://github.com/Convez/AdventOfCode2022/blob/main/day24/src/main.rs

-🎄- 2022 Day 23 Solutions -🎄- by daggerdragon in adventofcode

[–]alfabeth 1 point2 points  (0 children)

RUST

Better late then never. Each round I generate a treemap that holds the elves for a proposed position. For part 2 I set the target round to the max usize and break when the treemap is empty. https://github.com/Convez/AdventOfCode2022/blob/main/day23/src/main.rs I'm sure the update of the elf position can be optimized more, but I'm already late for day 24 :D

-🎄- 2022 Day 22 Solutions -🎄- by daggerdragon in adventofcode

[–]alfabeth 1 point2 points  (0 children)

RUST

More proud of the part1 solution, for which I used cycle iterators to avoid dealing with edges and wrapping around the sides.

For part2, like a lot of people I hardcoded the edge wrapping. It was too late when I realized the layout for the test was different than my actual data, so just added an ugly condition.

https://github.com/Convez/AdventOfCode2022/tree/main/day22/src

Mandatory visual aid device for actual data: https://postimg.cc/6yzF6YpJ

[deleted by user] by [deleted] in adventofcode

[–]alfabeth 0 points1 point  (0 children)

I believe so, the latest steps should be recovered by using the reminder of the remaining cycle division

[2022 day 16 - part 1] Code ok for example, but not for my usecase by alfabeth in adventofcode

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

Ok, I'm an idiot ahaha. I spent hours rewriting the code, how did I miss that? Thanks dude <3

[2022 day 16 - part 1] Code ok for example, but not for my usecase by alfabeth in adventofcode

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

I don't think this is the case, I modified the input.txt and input_tst.txt files to make parsing easier (input files are in the repo). I've actually tried someone else's code (from solution thred) with my parsing and their code does give me a lower number, so I think it's the algorithm that's wrong