Advent of Code
 

  You don't need to be an 'investor' to invest in Singletrack: 6 days left: 95% of target - Find out more

Advent of Code

217 Posts
32 Users
1 Reactions
1,437 Views
Posts: 0
Free Member
Topic starter
 

Doing this kind of thing in what I imagine FME to be sounds horrible

Yesterday's was really straightforward in FME as it was essentially a spatial problem and FME was initially developed as a tool for spatial data.

E.g. part two I just had to create a grid, discard the squares with 9 and dissolve the remaining squares together. The dissolve transformer helpfully keeps a count of all dissolved polygons, so then just keep the largest 3

screenshot


 
Posted : 10/12/2021 5:57 pm
Posts: 957
Free Member
 

Coming to this a bit late but just written my first ever Python program for the day 1 challenge and I'm impressed with PyCharm IDE. My very first program was written in Basic under the George 3 operating system on a remote teletype with the program stored on punch paper tape. Those were the days!


 
Posted : 10/12/2021 8:49 pm
Posts: 23277
Free Member
 

I prefer spyder. And more recently VS code


 
Posted : 10/12/2021 8:53 pm
Posts: 403
Free Member
 

Hoping to have some time this weekend to catch up, have chosen to try VS Code (vim for the win normally).

Finding a new editor heavier going than I would hope, am I so slow with it, and I haven't got the perl debugger working either, so there is no advantage !.


 
Posted : 10/12/2021 9:03 pm
Posts: 957
Free Member
 

Looks like VS code runs on Mac so will take a look.


 
Posted : 10/12/2021 9:09 pm
Posts: 23277
Free Member
 

Spyder is great for datasciencey type stuff. I tend to use it when I’m developing an algorithm or similar as it’s real easy to step in and out, explore variables/arrays etc and graph as you go.


 
Posted : 10/12/2021 9:14 pm
Posts: 0
Free Member
Topic starter
 

Not managed the last two days in vanilla FME thus far, have had to resort to using PythonCallers. Day 11 I'm pretty sure is possible, not sure about Day 12.

Glad to have something a bit easier in FME for Day 13.


 
Posted : 13/12/2021 8:38 am
Posts: 6856
Free Member
 

I found 13 quite satisfying and enjoyable, though it didn't require too much thought (probably for the best in my case!).


 
Posted : 13/12/2021 11:14 am
Posts: 1318
Free Member
 

It was quite satisfying to see intelligible letters appearing at the end :).

Especially after I misread the first part - well ignored the bit in bold - and was running to completion and not just the first step. Confused me as I was sure my code _should_ have been doing the right thing.


 
Posted : 13/12/2021 11:41 am
Posts: 3284
Full Member
 

Spent all day talking about log4j for some reason

I did d13 - yes a good ending to that one - not sure I'll get time to go back to 11 and 12 as it's going to be busy this week


 
Posted : 13/12/2021 4:15 pm
Posts: 1748
Free Member
 

...


 
Posted : 14/12/2021 11:48 am
Posts: 1318
Free Member
 

Day 14 was another quick one. Quite liked it but you could pretty much guess where part 2 was going to head..


 
Posted : 14/12/2021 12:16 pm
Posts: 8669
Full Member
 

I've just got round to Day 6 - lanternfish. I assume it's going to need some kind of clever coding to cater for part 2 to not make my laptop go pop?

using namespace System.Collections.Generic
$newlist = [List[int]]@()
$myList = [List[int]]@()

[int[]]$new

$lanternfish = Get-Content .\Day6.txt

$lanternfish.Split(",") | ForEach {
$mylist.add($_ )
}

for ( $i = 0 ; $i -lt 80 ; $i ++ ) {

$mylist | foreach {

If ($_ -gt 0 ) {
$new = $_
$new --
$newlist.add($new)
}
ElseIF ($_ -eq 0) {
$newlist.add(8)
$newlist.add(6)
}
}
$mylist = $newlist
$newlist = [List[int]]@()
}

$mylist.Count


 
Posted : 14/12/2021 4:15 pm
 Aidy
Posts: 2941
Free Member
 

I assume it’s going to need some kind of clever coding to cater for part 2 to not make my laptop go pop?

Yep.


 
Posted : 14/12/2021 4:40 pm
Posts: 3284
Full Member
 

Not got d14p2 yet. Yes, knew what was coming based on the use of the phrase 'This polymer grows quickly' in the description, but can't see a way to do it yet


 
Posted : 14/12/2021 5:13 pm
Posts: 1318
Free Member
 

If you want a hint...
The way I did it - there may well be better - I just kept track of the number of each pair. You don't need to know the order. You do, however need the first and last letter.

Then each generation - each Pair - for example NN becomes the same number of the two new pairs.

After all your generations - add how many of each letter you have, add the end ones, then divide by 2 to get the actual numbers (pairs double count all the letters except the end ones - but you've added those).

Now you have a (in my case) Map N -> 1234, C -> 4321, etc.

Edit - reading that, not sure it makes much sense.


 
Posted : 14/12/2021 5:55 pm
 Aidy
Posts: 2941
Free Member
 

If you want a hint…

I'm not sure that's a hint, so much as a spoiler.


 
Posted : 14/12/2021 6:41 pm
Posts: 403
Free Member
 

I'm just catching up - spent FAR TO LONG on the second half of day 12.

I was getting all the right answers for the test cases, but the wrong final answer for the real test data, which was a bit miffy as that was the first wrong answer submitted.

Spent half an hour looking at the code changes for p2 which were about 5 lines, only to find the true problem was a single line route length sanity check right out of the way I put in last night when I started it and mocked up the recursive search function, and the p2 changes made routes much longer than that, but all the test data was fine.

Doh. On to day 13.


 
Posted : 14/12/2021 7:09 pm
Posts: 403
Free Member
 

I’ve just got round to Day 6 – lanternfish. I assume it’s going to need some kind of clever coding to cater for part 2 to not make my laptop go pop?

Don't think about fish, think about where they go to learn.


 
Posted : 14/12/2021 7:12 pm
Posts: 2763
Free Member
 

You lot are clearly geeks, you'll know - Javascript, what's the best way to learn it, good beginner resources etc?

Any answer that starts with "ignore it and learn "x" instead will be given a good stiff ignoring, it's JS or nowt apparently.


 
Posted : 14/12/2021 8:35 pm
 Aidy
Posts: 2941
Free Member
 

Do you know any other programming languages?

And, what do you need to learn JS to do? Most of the interesting JS is using some kind of framework - you probably want to start from the right one.


 
Posted : 14/12/2021 8:37 pm
Posts: 2763
Free Member
 

Nope, complete beginner.

No idea why, it's just something they've been told they could do with learning for work. Yes, it's a very vague requirement!


 
Posted : 14/12/2021 9:03 pm
Posts: 3284
Full Member
 

w3schools


 
Posted : 14/12/2021 10:21 pm
Posts: 0
Free Member
Topic starter
 

I'm sure there must be a cleverer way of doing Part 2 today, but I just made a coffee whilst my workspace was running instead 🙂


 
Posted : 15/12/2021 8:46 am
Posts: 2763
Free Member
 

@LLama - Thanks for that - it looks like it should do the job, I might even have a go myself.


 
Posted : 15/12/2021 9:12 am
 Aidy
Posts: 2941
Free Member
 

I’m sure there must be a cleverer way of doing Part 2 today, but I just made a coffee whilst my workspace was running instead 🙂

I'm not even sure how to do part 1 in a reasonable amount of time


 
Posted : 15/12/2021 11:04 am
Posts: 1318
Free Member
 

That took longer than I'd be happy telling my boss!

I'm not sure there's a quick way to search all the possibilities. I managed to get part 1 down to <1s but part 2 was about a minute to run (2019 MacBook with an i9).

Is there a clever way to do it so that it's not just crunching away?


 
Posted : 15/12/2021 12:32 pm
 Aidy
Posts: 2941
Free Member
 

Devised a reasonably efficient way of solving part 1, finally.


 
Posted : 15/12/2021 1:00 pm
 Aidy
Posts: 2941
Free Member
 

... and it only took a couple of seconds to execute for part 2, which was nice.


 
Posted : 15/12/2021 1:29 pm
 Aidy
Posts: 2941
Free Member
 

Huh, I'd not actually seen the common algorithm used to solve the problem before.

I'm reasonably impressed with myself that I managed to invent it for myself relatively quickly.


 
Posted : 15/12/2021 1:55 pm
Posts: 1318
Free Member
 

@Aidy - throw up a link to the common algorithm, will you? Intrigued


 
Posted : 15/12/2021 3:43 pm
 Aidy
Posts: 2941
Free Member
 

@euain - RGlqa3N0cmE= (base64 encoded)

My input grid is sufficiently large that I can't work out how you get a solution for part 1 that doesn't scale linearly for part 2.


 
Posted : 15/12/2021 5:23 pm
Posts: 1318
Free Member
 

Thanks - will have a play. 🙂

Happy to share my non-optimal solution if interested but I'm pretty sure this is going to be much better.


 
Posted : 15/12/2021 5:28 pm
 Aidy
Posts: 2941
Free Member
 

Happy to share my non-optimal solution if interested but I’m pretty sure this is going to be much better.

Yeah, if you wouldn't mind.

My initial approach was to try to brute force every possible route, which worked okay for the sample set, but failed pretty miserably for the input. Tried a few approaches around making that more efficient, but it was fairly obvious that there were just too many permutations at that scale for it to ever fly.


 
Posted : 15/12/2021 5:44 pm
Posts: 0
Free Member
Topic starter
 

I've not attempted today's in just FME yet, I've completed it with FME/Python, I'm pretty sure part 1 is possible but I'm not sure I can be bothered as it will be a pain! Too much hard work understanding the puzzle today rather than actually solving it


 
Posted : 16/12/2021 5:17 pm
Posts: 1318
Free Member
 

It was a bit of a slog to work out what they were wanting. Nice wee recursive function at the end which was satisfying to see work.


 
Posted : 16/12/2021 5:30 pm
 Aidy
Posts: 2941
Free Member
 

Fiddly one today. I still haven't gotten part 2.

Passes the examples, and the first few params look okay (after decoding by hand), but I'm not getting the right answer :/


 
Posted : 16/12/2021 5:47 pm
 Aidy
Posts: 2941
Free Member
 

Oh, I missed the stupid prefix


 
Posted : 16/12/2021 6:07 pm
Posts: 1318
Free Member
 

Today was easy enough. Carried on with a slow brute-force solution (45s to solve) to part 2 but rejigged for 0.4s :).


 
Posted : 17/12/2021 1:12 pm
 Aidy
Posts: 2941
Free Member
 

Yeah, I just brute forced today. Wasn't proud of it.


 
Posted : 17/12/2021 1:26 pm
Posts: 3284
Full Member
 

had to put on hold now due to trying to get the stuff I'm paid for done in time for hols

might give todays a shot later


 
Posted : 17/12/2021 1:41 pm
Posts: 1318
Free Member
 

Mid dog-walk, worked out how to do part 1 with pen and paper (and managed to prove to myself there couldn't be any higher values of height that I hadn't reached). 14ms for the solution to b now :).


 
Posted : 17/12/2021 2:59 pm
Posts: 8669
Full Member
 

Finished Day 6Pt2 Lanternfish. Quite simple in the end but again, techie code issues muddied the water. Getting better tho.


 
Posted : 17/12/2021 4:32 pm
 Aidy
Posts: 2941
Free Member
 

Fiddly one today. Not really difficult, just some annoying code to write.

At least part 2 was trivial.


 
Posted : 18/12/2021 1:45 pm
Posts: 1318
Free Member
 

Yup, that sums it up. A bit of a slog on this one - and I managed to mess up the "get the number to the right of this one" stuff in a way I didn't spot for a while (trying to be too clever).

The folding one is still my favourite so far. (Or yesterday's one about launching drones but that's just because I managed to work out the first bit with a pen, paper and calculator - and that was being lazy).


 
Posted : 18/12/2021 7:02 pm
 Aidy
Posts: 2941
Free Member
 

Gosh, today's was hard work.


 
Posted : 19/12/2021 11:33 pm
 Aidy
Posts: 2941
Free Member
 

Today's was a bit sneaky, but went okay.


 
Posted : 20/12/2021 10:55 am
Posts: 1318
Free Member
 

Found Sunday's bloody hard work. Plenty of chance to get thoroughly confused for me.

Relief that today's was a lot easier - though I was disappointed I didn't get a nice picture out at the end. (Or maybe I should have and my output isn't working properly?). Not sure about sneaky - they repeated "it's infinite" a few times but took a wee bit of head scratching.


 
Posted : 20/12/2021 11:05 am
 Aidy
Posts: 2941
Free Member
 

Properly confused by part 2 today


 
Posted : 21/12/2021 9:48 am
 Aidy
Posts: 2941
Free Member
 

Worked it out, that required a lot of thinking.


 
Posted : 21/12/2021 1:31 pm
Posts: 1318
Free Member
 

Agreed - took a bit of thinking about and my clever shortcut didn't work at all and I had to start again.

Then I was getting the wrong answer and thought it should be right. Parked it to do some proper work. Fresh eyes found I'd managed to overtype something and put a bug in my code that works out the position when you add the dice roll to your current position. Step 1 was fine - step 2 was never returning position 10. Doh..


 
Posted : 21/12/2021 2:56 pm
Posts: 1318
Free Member
 

Annoying today - mine was just about working but numbers were slightly off. In a messy bit of code I was checking a "xmin" instead of "zmin" - so my cuboids weren't as they should be! OK after that.


 
Posted : 22/12/2021 4:12 pm
 Aidy
Posts: 2941
Free Member
 

I really can't seem to get today's to work, I'm doing something weird with calculating a compound sum, I think.


 
Posted : 22/12/2021 4:35 pm
Posts: 0
Free Member
Topic starter
 

I'm playing catchup as busy over the weekend but now away on holiday and it's peeing it down so it's keeping me occupied


 
Posted : 22/12/2021 4:53 pm
Posts: 1318
Free Member
 

I think mine's pretty solid for today so happy to supply alternate test cases / debugging scenarios if that helps.


 
Posted : 22/12/2021 5:07 pm
 Aidy
Posts: 2941
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 5:42 pm
 Aidy
Posts: 2941
Free Member
 

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


 
Posted : 22/12/2021 8:36 pm
 Aidy
Posts: 2941
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 11:58 am
 Aidy
Posts: 2941
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 5:06 pm
 Aidy
Posts: 2941
Free Member
 

never mind - got it.

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


 
Posted : 23/12/2021 5:40 pm
Posts: 1318
Free 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 9:37 pm
 Aidy
Posts: 2941
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 10:36 pm
Posts: 1318
Free 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 10:49 am
 Aidy
Posts: 2941
Free Member
 

Today's took longer than it should have


 
Posted : 24/12/2021 2:08 pm
Posts: 1318
Free 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 4:04 pm
 Aidy
Posts: 2941
Free Member
 

Nice fast one today


 
Posted : 25/12/2021 11:33 am
Posts: 1318
Free Member
 

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


 
Posted : 25/12/2021 1: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 4: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 9:24 pm
Posts: 1318
Free Member
 

And suddenly it's time for AoC 2022.

Nice gentle introduction today. Anyone else started?


 
Posted : 01/12/2022 4:14 pm
Posts: 5297
Full Member
 

I'm still having nightmares from last year.


 
Posted : 01/12/2022 4:38 pm
Posts: 3396
Free Member
 

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


 
Posted : 01/12/2022 10:55 pm
Posts: 3284
Full Member
 

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


 
Posted : 02/12/2022 7:26 am
Posts: 1383
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 7:45 am
 Aidy
Posts: 2941
Free Member
 

I'm in again this year


 
Posted : 02/12/2022 6: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 7:34 pm
Posts: 3284
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 8:50 pm
Posts: 7169
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 11:18 am
 Aidy
Posts: 2941
Free Member
 

How's everyone doing so far?


 
Posted : 13/12/2022 4:28 pm
Posts: 5297
Full Member
 

I'm halfway through day 1.


 
Posted : 13/12/2022 4:30 pm
Page 2 / 3

6 DAYS LEFT
We are currently at 95% of our target!