Advent of Code
 

Subscribe now and choose from over 30 free gifts worth up to £49 - Plus get £25 to spend in our shop

Advent of Code

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

Anyone else playing this year?

I'm attempting solutions using FME, but will resort to python within FME if a pure FME solution looks impossible.


 
Posted : 01/12/2021 8:33 am
 Drac
Posts: 50446
 

I concur.


 
Posted : 01/12/2021 8:36 am
Posts: 0
Free Member
Topic starter
 

I guess that's a no then 🙂


 
Posted : 01/12/2021 1:07 pm
Posts: 7179
Full Member
 

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


 
Posted : 01/12/2021 1:22 pm
Posts: 23296
Free Member
 

looked at problem 1, thought yeah I can do that and ate some chocolate. does that count?


 
Posted : 01/12/2021 1:23 pm
 grum
Posts: 4531
Free Member
 

I concur.

I think it's a coded message.


 
Posted : 01/12/2021 1:33 pm
Posts: 0
Free Member
Topic starter
 

Never seen this before, but just solved the first day with excel, is that cheating?

No, you can use whatever language/program you like


 
Posted : 01/12/2021 1:56 pm
 Drac
Posts: 50446
 

I think it’s a coded message.

In winter the red fox hunts the white hare.


 
Posted : 01/12/2021 2:17 pm
Posts: 1226
Full Member
 

looked at problem 1, thought yeah I can do that and ate some chocolate. does that count?

That reminds me of the old joke about the Engineer, Physicist and Mathematician.

They're all staying at a hotel overnight and by some freak chance a fire breaks out in each of their rooms.

The Engineer wakes up, sees the fire, quickly fills an ice-bucket with water, douses the flames and goes back to bed.

The Physicist wakes up, sees the fire, quickly fills and ice-bucket with water, quickly calculates the optimum angle and force to apply to the bucket given an assumed range and bucket mass, and neglecting the effects of air resistance as negligible; douses the flames, and goes back to bed.

The Mathematician wakes up, sees the fire, quickly determines that the problem is solvable, and goes back to bed.

Anyway. I had a go at Day 1. First time I've heard of FME: is it a natural fit for coding advent calendar problems?


 
Posted : 01/12/2021 2:24 pm
Posts: 1226
Full Member
 

(There wasn’t an RPGIV editor on replit.com, so I’m a bit stuffed otherwise).

It's also the first time I've come across RPGIV, too.

I desperately wanted it to be some kind of MMUD where you code by moving through ASCII-rendered dungeon rooms accumulating counters, fighting d-cache lookup misses, and vaulting NULL pointers, but sadly it's nothing like that at all.

Ignorance is bliss.


 
Posted : 01/12/2021 2:28 pm
 grum
Posts: 4531
Free Member
 

In winter the red fox hunts the white hare.

The sparrow farts gently in the autumn sun.


 
Posted : 01/12/2021 2:32 pm
Posts: 0
Free Member
Topic starter
 

First time I’ve heard of FME: is it a natural fit for coding advent calendar problems?

Based on past years, I'd say some puzzles are simpler in FME but most are more difficult (possibly impossible). I think I managed 44 stars out of 50 last year using FME and had to resort to python for the final 6.


 
Posted : 01/12/2021 2:49 pm
Posts: 403
Free Member
 

I'm in, hopefully using ICI as that's our language of choice at <work>, don't @ me.

Failing that, perl.


 
Posted : 01/12/2021 3:17 pm
Posts: 1226
Full Member
 

ICI as that’s our language of choice at <work>

Another new one! Today is a proper school day 😀


 
Posted : 01/12/2021 3:44 pm
Posts: 0
Free Member
 

Ooh this looks like just the sort of distraction from real work I like!

Failing that, perl.

Now there's something I've not heard mentioned for a few years, other than when asked by a friend 'What on is earth is Perl for the web?' when looking at the 20+ year old text books my iMac sits on.

See if I can dust off some of that old knowledge....


 
Posted : 01/12/2021 4:59 pm
Posts: 403
Free Member
 

Perl is my natural language of choice I guess, having used it for a few sites over the years but mostly backend processes these days. I can't remember the last time I bought a programming book, despite being addicted in my youth - probably something on WAP.

I just made a long list of all the languages I've used, and realised they are nearly all no longer used, , with the exception of c+variants and java/python, everything else back to algol/fortran is just about defunct. ICI is used ony at <work>, and almost no where else.


 
Posted : 01/12/2021 5:31 pm
kelvin reacted
Posts: 11402
Free Member
 

far to much reading involved for me.


 
Posted : 01/12/2021 5:36 pm
Posts: 23
Full Member
 

Just done day 3, nothing more than excel and a bit of sorting. Got a feeling my basic excel knowledge is not going to be enough fairly soon.


 
Posted : 03/12/2021 11:24 am
Posts: 77662
Free Member
 

It’s also the first time I’ve come across RPGIV, too.

I desperately wanted it to be some kind of MMUD

No use to me, I haven't played the first 3.


 
Posted : 03/12/2021 11:31 am
Posts: 6857
Free Member
 

I'm trying to do it in R, since I'm trying to become more competent in that language. I'm getting frustrated!

Stupid n00b question, the URL for the data is 'https://adventofcode.com/2021/day/1/input' but R (and Matlab, which I also tried) seem to want a file to read. I tried bunging .html, .php and /index.html at the end of that address, but it didn't work. How can I scrape the website? I've already got the answer by copying / pasting into excel then loading that into R but that seemed like an immediate failure.


 
Posted : 03/12/2021 1:13 pm
Posts: 7179
Full Member
 

I’ve already got the answer by copying / pasting into excel then loading that into R but that seemed like an immediate failure.

Nah, get it into whatever file format however you want to.


 
Posted : 03/12/2021 1:45 pm
Posts: 5300
Full Member
 

I'm in. Using Ruby.

How can I scrape the website?

I'm just copying the data into a local txt file. Parse into an array. Job done.


 
Posted : 03/12/2021 1:59 pm
Posts: 6857
Free Member
 

Fair enough. I just thought it should be dead easy to scrape the website itself rather than having additional files saved on my PC.


 
Posted : 03/12/2021 2:13 pm
Posts: 0
Free Member
Topic starter
 

I can just copy paste the data into my workspace but most of the python solutions I've seen use a local txt file as their input so I wouldn't worry about that. Puzzle inputs differ by user so you can't just simply scrape the website.

Part 2 of Day 3 is fairly hideous to do in FME but it's done.


 
Posted : 03/12/2021 4:33 pm
Posts: 0
Free Member
Topic starter
 

Yesterday's puzzle was really nice and straightforward in FME, only required one change to get part 2. Today's part 2 required a complete rewrite. You win some you lose some


 
Posted : 06/12/2021 1:37 pm
Posts: 7179
Full Member
 

Part 2 of Day 3 is fairly hideous to do in FME but it’s done.

Because use I'm a dick, I tried doing it just with SQL. Got the wrong answer and I had give up to to do some actual work...

Just looked at the bingo and the vents one, both look equally tricky...

Lanternfish looks pretty straight forward...


 
Posted : 06/12/2021 1:46 pm
Posts: 5590
Full Member
 

Another new one! Today is a proper school day 😀

Indeedy,FME and ICI ,I’d heard of RPGiv thou.

Perl’s a singer 🙂

Got enough work related coding challenges, without digging up a Chrissy one 🙂
(Who thought page numbering could be so interesting)


 
Posted : 06/12/2021 2:05 pm
Posts: 7474
Free Member
 

Does it get interesting at any point? The first few were the sort of trivial processing that I waste most of my life doing as a pre-requisite to getting any useful work done....


 
Posted : 06/12/2021 2:14 pm
Posts: 0
Free Member
Topic starter
 

FME is an ETL tool rather than a programming language, not sure if I'd made that clear 🙂


 
Posted : 06/12/2021 2:14 pm
 StuF
Posts: 2080
Free Member
 

Lanternfish looks pretty straight forward…

pt2 would be, except it starts blowing the array limit of javascript 🙂


 
Posted : 06/12/2021 2:25 pm
Posts: 403
Free Member
 

Gah - not even started - tonights the night !


 
Posted : 06/12/2021 3:44 pm
Posts: 8754
Full Member
 

Jeez, I'm stumped on day one. Powershelling it and I don't think my code is wrong but I must be missing something.


 
Posted : 06/12/2021 4:01 pm
Posts: 7474
Free Member
 

That was one line of R code...


 
Posted : 06/12/2021 5:26 pm
Posts: 1226
Full Member
 

Jeez, I’m stumped on day one. Powershelling it and I don’t think my code is wrong but I must be missing something.

Use the example as a test case: helps to debug when you know what the answer should be and why of course!


 
Posted : 06/12/2021 5:28 pm
Posts: 8754
Full Member
 

did it in excel (correctly) and it was 1 more than my original answer, 2 more than my afterthought answer. I'm still stumped to the logic. Something is back to front.

But it works on the example data.

#feelingthick


 
Posted : 06/12/2021 7:07 pm
 Aidy
Posts: 2965
Free Member
 

Does it get interesting at any point?

I've been running through last years, some have required a bit of thought.


 
Posted : 06/12/2021 7:12 pm
Posts: 1226
Full Member
 

did it in excel (correctly) and it was 1 more than my original answer, 2 more than my afterthought answer. I’m still stumped to the logic. Something is back to front.

But it works on the example data.

If the code is right could the data be wrong? Some copy/paste error or similarly frustrating PEBKAC?


 
Posted : 06/12/2021 7:23 pm
 Aidy
Posts: 2965
Free Member
 

did it in excel (correctly) and it was 1 more than my original answer

It is one of the two hard problems in computer science:

https://twitter.com/codinghorror/status/506010907021828096?lang=en-GB


 
Posted : 06/12/2021 7:35 pm
Posts: 8754
Full Member
 

Well, the same data & logic worked for D1P2, so truly stumped.


 
Posted : 06/12/2021 8:19 pm
Posts: 403
Free Member
 

@jimmy - post code if you are stuck, probably something very simple.

I cocked my first few attempts up by not using strict in perl and mistyping a variable name - noob.


 
Posted : 06/12/2021 10:39 pm
Posts: 0
Free Member
Topic starter
 

I was able to brute force a solution this morning before I stumbled on a cleverer way


 
Posted : 07/12/2021 11:41 am
Posts: 3291
Full Member
 

this is much more interesting than the meeting I am in

got to day 3 part 2


 
Posted : 07/12/2021 12:37 pm
Posts: 3291
Full Member
 

d3p2 took some typing


 
Posted : 07/12/2021 2:09 pm
Posts: 8754
Full Member
 

@jimmy – post code if you are stuck, probably something very simple.

Thanks. The fact it works for D1P2 suggests there's some data nuance I've missed. But I'm onto D2P2 now. Just doing it because I miss scripting now absent from the day job.


 
Posted : 07/12/2021 2:19 pm
Posts: 403
Free Member
 

Oh dear - I posted the wrong AoC STW code a few minutes ago - apologies if you joined and then get booted from our work leaderboard.

I have created a STW leaderboard, where we can all revel in our lack of effort.

Its the end of no-effort November, into born-to-be-mild December.

The correct code is, scouts honour checked it a few times now, 502307-275d7a99

Thanks
Ant


 
Posted : 07/12/2021 2:26 pm
 StuF
Posts: 2080
Free Member
 

I'm sure there's a thread about work ethic and not being distracted by quizzes. I could waste a lot of time with these


 
Posted : 07/12/2021 2:26 pm
 Aidy
Posts: 2965
Free Member
 

Thanks. The fact it works for D1P2 suggests there’s some data nuance I’ve missed.

Probably miscounting at the start/end, and works for p2 because comparing n-1/n+1 happens to give you the right answer despite that.


 
Posted : 07/12/2021 3:29 pm
Posts: 6857
Free Member
 

Out of interest, how long are these taking people?

I can code stuff semi-competently in Matlab but as stated I'm trying it in R. I can think up a possible solution within seconds, but getting it into a script takes time, and there's always some error / troubleshooting to be done (converting numbers to strings is a PITA, and I don't quite 'get' data structures and indexing in R very fluidly). As a result, I reckon each day's challenge probably takes at least an hour.


 
Posted : 07/12/2021 3:54 pm
 Aidy
Posts: 2965
Free Member
 

Out of interest, how long are these taking people?

I think they've all been under 10 minutes so far. Before I've gotten to the bottom of the first cup of coffee, anyway.

The leaderboard times are pretty impressive - 1:32 for the fastest to get to both stars today.

https://adventofcode.com/2021/leaderboard/day/7


 
Posted : 07/12/2021 4:08 pm
Posts: 0
Free Member
Topic starter
 

It varies for me depending on the nature of the problem. Saturday probably took me an hour for both parts, Sunday only 10 minutes. I'd nearly always be able to do them more quickly in python, but the challenge I've set myself is to do them in FME.

Also, if you've done previous contests, you get to know the style of problems they set so that makes things easier.

Nine times out of ten, if you can brute force a solution for part 1, you'll find part 2 needs a rewrite so you know to start looking for patterns or alternative ways of getting the answer. Today's was unusual in that you could complete part 2 even with a naive solution for part 1


 
Posted : 07/12/2021 4:19 pm
Posts: 6857
Free Member
 

Hmm, that's not making me feel better 😀 Are you guys professionals?


 
Posted : 07/12/2021 4:26 pm
Posts: 1226
Full Member
 

I can code stuff semi-competently in Matlab but as stated I’m trying it in R. I can think up a possible solution within seconds, but getting it into a script takes time, and there’s always some error / troubleshooting to be done (converting numbers to strings is a PITA, and I don’t quite ‘get’ data structures and indexing in R very fluidly). As a result, I reckon each day’s challenge probably takes at least an hour.

The trouble you have there IMO is that you're not "doing advent of code", you're doing advent of code as a part of the process of learning R.

If you had the language details at your fingertips you'd be able to concentrate on the problems and solutions rather than looking up language details.


 
Posted : 07/12/2021 4:38 pm
 Aidy
Posts: 2965
Free Member
 

Are you guys professionals?

Yes.

But yeah, you're learning a new language - trying at all is winning.


 
Posted : 07/12/2021 4:43 pm
Posts: 0
Free Member
Topic starter
 

Are you guys professionals?

I'm not a programmer/developer but I'm solving them with FME which is pretty much my day job. Although the data wrangling I do day to day is quite far removed from Advent of Code type puzzles.


 
Posted : 07/12/2021 4:50 pm
Posts: 6857
Free Member
 

Yeah you're right. I just did both parts of day 7 in my favoured Matlab code and got it done in about 15 mins. Not lightning quick but waaay quicker.

R is kind of similar to Matlab* but sufficiently enough that I have to look up nearly everything!

* Python is also similar


 
Posted : 07/12/2021 4:52 pm
Posts: 6857
Free Member
 

Just doing the Lanternfish exponential growth one and it's broken my computer! I guess my code was pretty inefficient. 80 iterations ran quickly, and I thought that my code allowed me to simply swap number_iterations=80 for 256 and press run. But instead, I've run out of RAM 😀


 
Posted : 07/12/2021 5:31 pm
 Aidy
Posts: 2965
Free Member
 

But instead, I’ve run out of RAM

640K is all you really need.


 
Posted : 07/12/2021 6:07 pm
Posts: 0
Free Member
Topic starter
 

I had to do a complete rewrite for part 2 of lanternfish too 🙂


 
Posted : 07/12/2021 6:11 pm
Posts: 3291
Full Member
 

For me so far d4 took the longest, d5-7 not very long, I had to redo the fish one too

They are all in a similar style but how people get sub 2 mins I have no idea


 
Posted : 07/12/2021 6:31 pm
 Aidy
Posts: 2965
Free Member
 

They are all in a similar style but how people get sub 2 mins I have no idea

A lot of it is just having done enough of them, and built up enough of a toolkit to refer to.

I've been doing them pretty leisurely in the morning whilst I'm still waking up, and flipping languages for fun, but if I was taking it seriously, I'd probably be looking at 3-4 minutes for most of them so far.


 
Posted : 07/12/2021 6:44 pm
Posts: 6857
Free Member
 

640K is all you really need.

Can't work out if that's just a computer joke, or whether it's a serious attack on my code optimisation 😀


 
Posted : 08/12/2021 8:50 am
Posts: 6857
Free Member
 

Oooooohh. Yeah. 😀

(I just worked out how to do the Laternfish one in less than a second of computing time and definitely less than 8Gb RAM)


 
Posted : 08/12/2021 9:30 am
Posts: 0
Free Member
Topic starter
 

I made the mistake of trying to read today's puzzle before coffee, took me 5 minutes to work out what they were asking for nevermind solving it!


 
Posted : 08/12/2021 9:33 am
Posts: 8754
Full Member
 

Stalled on D3 last night. I have a theory but it's testing my PS knowledge. As usual, I'm sure there are inbuilt clever ways to do it but I'm too old skool clunky.


 
Posted : 08/12/2021 12:34 pm
 Aidy
Posts: 2965
Free Member
 

Today's took quite a bit of effort. Hared off down the wrong path trying to be too clever to start with.


 
Posted : 08/12/2021 1:57 pm
Posts: 0
Free Member
Topic starter
 

My solution today feels clunky but not sure I can make it any more elegant in FME


 
Posted : 08/12/2021 3:51 pm
Posts: 365
Full Member
 

I think I’ve given up at day 4 having spent the best part of an hour today writing the world biggest nested for loop to get halfway to the answer and then being stumped on where to go next. Maybe next year I’ll have more python skills.


 
Posted : 08/12/2021 6:56 pm
Posts: 0
Free Member
Topic starter
 

You don't need to complete a day to go on to the next so you can always dip in and out.


 
Posted : 08/12/2021 7:29 pm
Posts: 3291
Full Member
 

Yes didn't get today's figured out before I had to start doing paid work, it's tricky


 
Posted : 08/12/2021 7:31 pm
Posts: 356
Full Member
 

I too niaively thought I'd just up the iterations for the lanternfish 😁


 
Posted : 08/12/2021 8:09 pm
Posts: 0
Free Member
Topic starter
 

Loved today's puzzle, right up my street.


 
Posted : 09/12/2021 8:30 am
Posts: 3291
Full Member
 

yes it was a good one

I'll go back to yesterday's later, I think I need to read it again because I'm not seeing it


 
Posted : 09/12/2021 10:39 am
Posts: 3291
Full Member
 

Got yesterday's. The way I read it made me think that some clever trick was necessary. In the end I did a big search.


 
Posted : 09/12/2021 4:46 pm
Posts: 356
Full Member
 

I enjoyed todays; took me back to my youth creating programs to draw graphics in 8-bit micros 😀


 
Posted : 09/12/2021 5:19 pm
Posts: 8754
Full Member
 

Just finished Day3Pt1. I had the logic early on, just getting the code to work for me took way too long.

This is fun / addictve but I don't really have the time!


 
Posted : 09/12/2021 10:32 pm
Posts: 3231
Full Member
 

CBA this year. I've started it the past couple of years, but after about 2 weeks in it tends to require about an hour every day, and the mental energy, neither of which I have.


 
Posted : 09/12/2021 11:50 pm
Posts: 1323
Full Member
 

It is a fun wee puzzle after breakfast - thanks for posting OP. I'm lazy so cheating and just doing it in Java.

I thought today's was quite a bit easier than yesterdays - once I realised my answers were bigger than 2^32 and my scores going negative. Doh..


 
Posted : 10/12/2021 11:15 am
 Aidy
Posts: 2965
Free Member
 

Nice quick one today


 
Posted : 10/12/2021 2:38 pm
Posts: 0
Free Member
Topic starter
 

I've got all the stars for days 1 through 10 in FME which is an improvement on last year. I had to resort to a pythoncaller within FME for part 2 of one of the puzzles by this stage last year.

Pleasantly surprised that my part 1 solution today led nicely into part 2


 
Posted : 10/12/2021 2:41 pm
Posts: 3291
Full Member
 

Took longer than d9, but I switched to a style/lang I am less familiar with (excuses, excuses). Got a tidy solution though. I suspected what part 2 would be, so getting the point was easier than figuring the convoluted score!

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


 
Posted : 10/12/2021 5:45 pm
Page 1 / 3