Forum menu
Advent of Code
 

Advent of Code

 Aidy
Posts: 2977
Free Member
 

Cheers! It's not the test cases I'm stuck on though, I'm failing at something something nested intersecting cubes.


 
Posted : 22/12/2021 6:42 pm
 Aidy
Posts: 2977
Free Member
 

Got it, finally. Had to have a small hint to think about it differently.


 
Posted : 22/12/2021 9:36 pm
 Aidy
Posts: 2977
Free Member
 

Just did part 1 on paper today, can't see a solution for part 2 yet, let alone the lowest cost solution.


 
Posted : 23/12/2021 12:58 pm
 Aidy
Posts: 2977
Free Member
 

@euain - if you end up with some code to do part 2, and wouldn't mind checking my input, I'd appreciate it. I'm really not seeing *any* solution for it.


 
Posted : 23/12/2021 6:06 pm
 Aidy
Posts: 2977
Free Member
 

never mind - got it.

... but there can't be more than one solution...


 
Posted : 23/12/2021 6:40 pm
Posts: 1335
Full Member
 

Not had a chance to attack it today. Not quite sure how I’m going to go about this. Hopefully get some time tomorrow.


 
Posted : 23/12/2021 10:37 pm
 Aidy
Posts: 2977
Free Member
 

I think I've got a solution that will work, just need to add scoring to it.

It's *absurd*, though.


 
Posted : 23/12/2021 11:36 pm
Posts: 1335
Full Member
 

Amphipod one worked OK. My solution wasn't too clever but both parts solve in <1s (I think mainly because it's just an small-ish integer array) so I'll take that. Sheer luck meant I just had minor changes between pt 1 and 2.


 
Posted : 24/12/2021 11:49 am
 Aidy
Posts: 2977
Free Member
 

Today's took longer than it should have


 
Posted : 24/12/2021 3:08 pm
Posts: 1335
Full Member
 

Still to do more than have a wee look over that one. I wonder how long a brute-force approach is going to take on that :).


 
Posted : 24/12/2021 5:04 pm
 Aidy
Posts: 2977
Free Member
 

Nice fast one today


 
Posted : 25/12/2021 12:33 pm
Posts: 1335
Full Member
 

I’ve got a geeky few hours booked in for Boxing Day. Still got 24 and 25 to do.


 
Posted : 25/12/2021 2:27 pm
Posts: 0
Free Member
Topic starter
 

I'm still playing catch-up after being away. Just completed Day20.

https://imgur.com/a/OfPpUe0


 
Posted : 05/01/2022 5:16 pm
Posts: 0
Free Member
Topic starter
 

Not a fan of Day24, wasted a load of time creating my Arithmetic Logic Unit then had to go in a totally different direction.

Day25 nice and straightforward, still short 8 stars


 
Posted : 06/01/2022 10:24 pm
Posts: 1335
Full Member
 

And suddenly it's time for AoC 2022.

Nice gentle introduction today. Anyone else started?


 
Posted : 01/12/2022 5:14 pm
Posts: 5300
Full Member
 

I'm still having nightmares from last year.


 
Posted : 01/12/2022 5:38 pm
Posts: 3449
Free Member
 

First time for me this year. So far so good...


 
Posted : 01/12/2022 11:55 pm
Posts: 3323
Full Member
 

Bit busier this year, have to do them in dribs and drabs


 
Posted : 02/12/2022 8:26 am
Posts: 1468
Full Member
 

Never seen this before.

Never seen this before, but just solved the first day with excel, is that cheating? (There wasn’t an RPGIV editor on replit.com, so I’m a bit stuffed otherwise).

RPG ? I haven’t written any RPG in anger for over a decade, probably longer. Let me dig out that old as/400 I have in the loft….


 
Posted : 02/12/2022 8:45 am
 Aidy
Posts: 2977
Free Member
 

I'm in again this year


 
Posted : 02/12/2022 7:14 pm
Posts: 13594
Free Member
 

There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors.

— Jeff Atwood (@codinghorror) August 31, 2014

Never seen that before, but spot on. Although you could add reucursion..


 
Posted : 02/12/2022 8:34 pm
Posts: 3323
Full Member
 

First time for me this year. So far so good…

If it's like last year, you can knock the first 10 days or so out without thinking too hard, but after that they get steadily trickier, and the last week is not easy (average/good sw bod with 30 years experience)


 
Posted : 02/12/2022 9:50 pm
Posts: 7203
Full Member
 

Took me 20 minutes to remember how to convert text files into DB2 tables, so not holding out too much hope for me being able to do this in a timely manner 🙂

Will have a crack at lunchtime…


 
Posted : 05/12/2022 12:18 pm
 Aidy
Posts: 2977
Free Member
 

How's everyone doing so far?


 
Posted : 13/12/2022 5:28 pm
Posts: 5300
Full Member
 

I'm halfway through day 1.


 
Posted : 13/12/2022 5:30 pm
Posts: 1335
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.


 
Posted : 13/12/2022 10:43 pm
 5lab
Posts: 7926
Free Member
 

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


 
Posted : 13/12/2022 11:22 pm
 5lab
Posts: 7926
Free Member
 

Ok stw leaderboard code is 2114560-90631d35

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


 
Posted : 13/12/2022 11:25 pm
 Aidy
Posts: 2977
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.


 
Posted : 13/12/2022 11:25 pm
 Aidy
Posts: 2977
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).


 
Posted : 13/12/2022 11:29 pm
 5lab
Posts: 7926
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


 
Posted : 14/12/2022 11:52 am
 Aidy
Posts: 2977
Free Member
 

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


 
Posted : 14/12/2022 2:33 pm
Posts: 1335
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
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.


 
Posted : 14/12/2022 6:46 pm
 5lab
Posts: 7926
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..


 
Posted : 14/12/2022 7:01 pm
 Aidy
Posts: 2977
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.


 
Posted : 14/12/2022 7:15 pm
Posts: 1335
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 😂


 
Posted : 14/12/2022 8:28 pm
 Aidy
Posts: 2977
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


 
Posted : 14/12/2022 8:31 pm
Posts: 23334
Free Member
 

Did day one earlier in a bit of downtime.

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


 
Posted : 14/12/2022 10:07 pm
 5lab
Posts: 7926
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)


 
Posted : 15/12/2022 1:39 pm
 Aidy
Posts: 2977
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.


 
Posted : 15/12/2022 2:49 pm
 5lab
Posts: 7926
Free Member
 

2s is fast - what approach did you use?

Spoiler
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..


 
Posted : 15/12/2022 4:07 pm
 Aidy
Posts: 2977
Free Member
 

How do I do spoiler blocks?


 
Posted : 15/12/2022 6:47 pm
Posts: 1335
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 ]


 
Posted : 15/12/2022 9:55 pm
Posts: 1335
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.


 
Posted : 15/12/2022 10:20 pm
 Aidy
Posts: 2977
Free Member
 

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

Spoiler

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.


 
Posted : 15/12/2022 11:48 pm
Page 4 / 5