Home Forums Chat Forum Advent of Code

Viewing 40 posts - 161 through 200 (of 218 total)
  • Advent of Code
  • euain
    Full Member

    First 12 done. Meetings all day today so not even started 13. Might get a chance lunch tomorrow.

    It seems easier than last year so far. Only one that’s needed anything really fixed to get from part 1 to 2. Last year there were a few in the first week where you needed to change your algorithm completely to keep the numbers sane.

    5lab
    Free Member

    13 was way easier than 12 imo. Just getting through it step by step. Anyone fancy an stw leaderboard?

    5lab
    Free Member

    Ok stw leaderboard code is 2114560-90631d35

    URL is https://adventofcode.com/2022/leaderboard/private/view/2114560

    Aidy
    Free Member

    It seems easier than last year so far.

    Yeah, I thought so too. I wondered if it was just because I was more familiar with the style of puzzle.

    Aidy
    Free Member

    13 was way easier than 12 imo.

    13 had a sneaky case that wasn’t covered by the example that caught me out for a couple of minutes, I found 12 fairly straightforward (but we had a pretty similar puzzle last year, and I could remember how I solved it).

    5lab
    Free Member

    todays was quite enjoyable, I had a bug in my line drawing which meant it wasn’t working quite right, drawing out the grid is quite satisfying for debug purposes

    Aidy
    Free Member

    I thought today’s was pretty dull, tbh. Didn’t really have to think and could just tap out a solution.

    euain
    Full Member

    Caught up now – 13 was a bit messy. 14 was kind of fun but a lot simpler (and I’m sure there’s a nicer way to do it than my brute-force way – but I still solved in well under a second.

    13 was messy but Part 2 was a doddle by sheer luck – I solved part 1

    Spoiler for
    with a comparator between 2 messages (in Java) which meant that when it came to sorting them, I just shoved the lot into a sorted set and they were sorted for me.

    Longest for me so far was day 9 – ropes. Really annoying – all the logic was right but I was only reading one digit of the movement counter.. R 19 was parsing as R 1. Careless mistake but took ages to work it out.

    5lab
    Free Member

    yeah I did day 13 the same way as you (albeit in kotlin) so the second part took all of 1 minute to complete..

    Aidy
    Free Member

    I stumbled a bit on the second part of the knots one too – turns out actually slowing down and reading the text helps sometimes.

    Probably the one that’s caught me out for the longest was the second part of day 11.

    euain
    Full Member

    I was lucky with that one (path finding, wasn’t it?). It was one line of code for me – just had to set everything with height “a” to be reachable in 0 steps. That was a relief as I had to get back to work 😂

    Aidy
    Free Member

    11 was the divide by 3 one (turns out that neither longs nor bigints were the answer), path finding one was easy after last year

    jam-bo
    Full Member

    Did day one earlier in a bit of downtime.

    Biggest takeaways for me is how easy vscode web and GitHub codespaces are..

    5lab
    Free Member

    urgh part 2 of todays is Tough. took a lot of rework to get mine to perform reasonably (runs in <10s in the end)

    Aidy
    Free Member

    Yeah. Took me a while to devise a reasonable algorithm too. Runs in about 2s – could probably shave some off, but that’ll do.

    5lab
    Free Member

    2s is fast – what approach did you use?

    Spoiler for
    I iterated over the pixels immediately right of the right hand edge of each border, then looked whether that pixel was inside another shape’s area. The left edges are covered by the other shapes looking at their right edges..
    Aidy
    Free Member

    How do I do spoiler blocks?

    euain
    Full Member

    I was tying myself in knots today trying to get a clever way to solve part 2. I think I was on the track to doing something nice and fast with overlapping diamonds but in the end I decided to see how long the brute force would take. Ended up being 19s so I’ll just take that at the moment. Attack again when I have some time to spare.

    Spoiler blocks – put [ then word “spoiler” then ] – close it with [ \ same word ]

    euain
    Full Member

    Make that 8s on the brute-force method (minor tweaks and realised I was running with Java 8 not 19 – good performance increase). Time to leave the computer, I think.

    Aidy
    Free Member

    Ah, I’d been trying with lt/gt tags – like all the other ones.

    Spoiler for
    I basically had an efficient brute force.

    Sort the sensors by descending Manhattan number.

    Iterate over all the valid values of Y:
    Start with a set of intervals [[0,4e6]]
    For each sensor; calculate the min, max values of X for the given Y
    Subtract this interval from the set of possible X values (e.g. [[0,100]] – [10,20] => [[0,9],[21,100]])
    If the set of intervals becomes empty, shortcut to the next Y value
    If we reach the end of the sensors, and the set is non-empty, then that’s the answer.

    euain
    Full Member

    Day 15 still and a wee optimisation tweak – I was pre-working out and caching some information that I didn’t need. So 6ms for part 1 and 2.3s for part 2. That’ll do at the moment. I’ve got a free evening to have a look at Day 16 tonight.

    Still “brute-force” but it’s just brute forcing a very quick operation. 🙂

    Aidy
    Free Member

    Another hard one today

    5lab
    Free Member

    yeah I found round 1 easy enough – few bugs but the logic was ok. Took me ages to wrap my head around part 2 – algo ran for 15 mins in the end, so I expect I missed something 😀

    Aidy
    Free Member

    I found part 1 pretty hard. My solution for part 2 runs in just over a minute, but I’m really not proud of it.

    jimmy
    Full Member

    Just seen this. Will try and play catch up, although my powershell skills are even rustier than last year and I didn’t do so well then.

    euain
    Full Member

    That was ok-ish. Done now and part 2 solves in just under a second. It’s not pretty though.

    Spoiler for
    No idea if it’s of any interest. Pretty simplistic solution it just explores every step it can from AA (with 2 positions for part 2). I think the reasonable performance is that it generates a load of paths but aggressively gets rid of ones that can’t be the optimal solution. That way you’re never keeping track of too many routes through the tunnels (max about 4k).

    I’m sure there’s a better A* way to do it though that is a few milliseconds.

    Aidy
    Free Member

    I’m pretty impressed with the proportion of active people to getting solutions on here – I’m in actual programming groups who don’t have as good a ratio.

    5lab
    Free Member

    found today fairly straight forwards – just a case of chunking through. Still tried to brute force part 2 which is never the right answer 😀

    21ms and 310ms respectively

    5lab
    Free Member

    and todays is even easier than yesterdays. sub hour for me!

    Spoiler for
    i used a bfs on part 2 to find paths out of the blob
    butcher
    Full Member

    Finally got round to completing day 1. Don’t think I’ll be topping any leader boards.

    Aidy
    Free Member

    Had part 1 in about 5 minutes today, flailed a lot with part 2, but got there in the end.

    euain
    Full Member

    Up to date again. I didn’t really enjoy 17 – silly mistake and then an ugly solution:

    Spoiler for
    For the Tetris “can I move left, right?” I was only checking the outside column was clear to move. Worked great most of the time but it was failing at step 27 or something. Easy fix once I worked out where it was failing.

    The second part, I was lucky. Lots of visualisation for debugging part 1 then checked what the status was when I was looping the wind to the start of the file and found the picture looked the same. Then an ugly “it gains this many rows for the loop over wind” – different number for the first loop and then the last couple of hundred steps. Dumped the numbers into Excel and worked out total.

    .

    Day 18 was fun. Liked that.

    Aidy
    Free Member

    euain – yeah, I had a silly bug where I’d changed which direction I considered to be up halfway through, and didn’t catch all the places.

    Part 2 I got more through luck than being clever, I think. It actually fails on the example!

    Aidy
    Free Member

    Today’s is properly wtf.

    5lab
    Free Member

    yesterdays took me ages. the thing that got the performance managable (it never finished before) was

    Spoiler for
    a depth first search, but instead of searching 5 options (4 robots and do nothing) I just worked out the min time to each robot (with the right number of no robots) and then added that robot pre-pended with the right number of “no robot” moves to the stack.

    today is much easier!

    Aidy
    Free Member

    I had a really annoying off by one error that took me ages to find today, but otherwise okay.

    euain
    Full Member

    Robots was a hard one for me – spent far too long messing about with that.

    Spoiler for
    Eventually managed a pretty basic way to reduce number of branches / discard options by discarding option to make more clay, ore or obsidian robots if we already had enough to saturate production of one obsidian or one geode cracker for the rest of the run. Also added a basic “is this state worse than one I already have” which said if, on the same minute, you have less/equal stocks of all the resources and robots then don’t bother adding this new option. These were enough to get part 2 in something like 30s.

    Todays was a lot easier though I had to scratch my head to get one case that seems a bit inconsistent.

    Spoiler for
    So if you have 1 2 -2 5 6 or something and process the -2. It had it going to the start of the list rather than looping to after 6. It is covered in one of the samples but I was moving its index from 2 to 0 and putting it into 0. Then my fix for this erroneously put an initial 0 to the end of the list when it wasn’t moving. Index 0 to index 0 – oh, invoke the wrap to end case and shove it at the end.
    Aidy
    Free Member

    I’m glad I’m not the only person who flailed a bit today

    Spoiler for
    I went straight for a doubly linked list, had off by one errors for when it was moving over itself.

    Took me *ages* to find. And, for the first time, I ended up debugging against someone else’s solution.

    euain
    Full Member

    Todays was very nice, I thought.

    No complex rules and ended up solving the problem properly (60ms running time, including parsing the file) while my computer was still trying to brute-force the solution (stopped after 2h I could see it was still miles off).

    Spoiler for
    Recursion both ways but for part 2, I worked out that the variable number was only in one location – so in any operation, only one side was dependent on the variable. Just recursed down from “root” setting the value of any operation on the side containing the variable to the value needed to set that monkey’s response. Worked first time. Time for lunch.
    Aidy
    Free Member

    Yeah, plain sailing today.

    The only thing was thinking it’d be quicker to solve the last bit by hand rather than writing code.

    Spoiler: It was not.

Viewing 40 posts - 161 through 200 (of 218 total)

You must be logged in to reply to this topic.