• This topic has 211 replies, 30 voices, and was last updated 4 months ago by Aidy.
Viewing 40 posts - 81 through 120 (of 212 total)
  • Advent of Code
  • ebygomm
    Free Member

    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

    shinton
    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!

    jam-bo
    Full Member

    I prefer spyder. And more recently VS code

    haloric
    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 !.

    shinton
    Free Member

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

    jam-bo
    Full 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.

    ebygomm
    Free Member

    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.

    Superficial
    Free Member

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

    euain
    Full 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.

    llama
    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

    rickon
    Free Member

    euain
    Full Member

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

    jimmy
    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

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

    llama
    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

    euain
    Full 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.

    Aidy
    Free Member

    If you want a hint…

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

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

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

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

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

    IvanDobski
    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!

    llama
    Full Member
    ebygomm
    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 🙂

    IvanDobski
    Free Member

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

    Aidy
    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

    euain
    Full 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?

    Aidy
    Free Member

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

    Aidy
    Free Member

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

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

    euain
    Full Member

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

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

    euain
    Full 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.

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

    ebygomm
    Free Member

    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

    euain
    Full 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.

    Aidy
    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 :/

    Aidy
    Free Member

    Oh, I missed the stupid prefix

    euain
    Full Member

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

    Aidy
    Free Member

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

Viewing 40 posts - 81 through 120 (of 212 total)

You must be logged in to reply to this topic.