Advent of Code - adventofcode.com

Posted on
Page
of 21
  • Tomorrow...

  • Actually planning to start on day one this year, looking forward to it - probably going to mix (alternate?) Python and R.

  • I shall start in Scala and see how soon I have to fall-back to python.

  • I'm going to do it in assembly and brainfuck.

    Who am I kidding. It'll be Python all the way.

  • I should really do it in Python. My new job will involve more python than I am used to. I write quicker in Java though, and I would like to do some Rust.

  • It's here! Day 1 starts of as gently as always. Did it quickly this morning in Python, but plan to do some days in Haskell as well.

  • Who is doing it in Copilot this year?
    ...
    https://gfycat.com/rectangularlamearmednylonshrimp

  • Huh, doesn't even have to see the signature of that function. Or does it just work because other people have committed their solutions to GH? Some sort of generative language model.

  • Yep, in a pre-copilot world someone did a bot in a previous year that just searched github for specific terms like "aoc day <n>" and downloaded the code, worked out what language it was, compiled it and ran it with the new input and auto submitted the answer.

  • For anyone interested in using R for coding the projects, an on-line event for discussion of the Advent of Code in R was announced on the Allstat mailing list.

    "------------------------------
    Date: Tue, 30 Nov 2021 14:05:20 +0000
    From: David Selby
    Subject: EVENT: Advent of Code R discussion - Fri 3 December

    The Advent of Code (https://adventofcode.com), a series of daily programming puzzles running up to Christmas, starts soon. On 3 December, the R-thritis Statistical Computing Group at the University of Manchester Centre for Epidemiology, jointly with Warwick R User Group, is hosting an informal online meetup where we will discuss different approaches to tackling (and hopefully solving) the challenges using R and related languages/tools. This is a good opportunity for R newbies to familiarise themselves with basics of programming syntax, as well as for advanced users to learn tips and tricks.

    Join us on Friday 3 December at 10:00 via MS Teams. We'll discuss how we solved (or got stuck) on the first 2 days' problems.

    https://www.meetup.com/Warwick-useRs/events/282303150/

    Best regards,

    David Selby
    Research Associate in Data Science
    Centre for Musculoskeletal Research
    University of Manchester
    ------------------------------"

  • Nice. Will try to join if I can find the time! Been going to do it this year

  • Have decided to at least start in Clojure this year. Will fall back to Scala if needed.

    Completely new to Clojure, so will be tracking other solutions online after I've completed each day to see how I can improve. Here's the gist of day 1: https://gist.github.com/dmckennell/21aeee2c44ff52a868e69f5d6c17ccb7

  • Bring back intcode

  • Starting in rust this year, let's see when I give up https://gist.github.com/wence-/500e1bc4633192ac6fee67433aedd974

  • My python effort for today:

    https://github.com/tango130/AoC_2021

    Pretty much self taught so any pointers/guidance is welcomed!

  • Both look good.

    The obvious optimisation for part2 is that if you're comparing A+B+C against B+C+D then you're only really comparing A against D as both have B+C in common. So it becomes much like part1 in that you only need to compare inputs[x] against inputs[x+3].

  • In my tradition of using inappropriate languages I've gone for jsonnet this year

    local input = std.map(std.parseInt, std.split(std.rstripChars(importstr 'input', '\n'), '\n'));
    
    std.count(std.map(function(idx) input[idx + 3] > input[idx], std.range(0, std.length(input) - 4)), true)
    
  • That would get you hired where I am

  • I did something in jsonnet yesterday which took 5G of RAM and 20mins to complete 🤣

  • Day 2 pretty straightforward in jsonnet, too: https://github.com/rhowe/aoc/blob/main/02/2part2.jsonnet

  • Finally got day 1 part 2 this morning: https://github.com/nathwilson22/aoc2021/blob/77c077c0b7ed4a9dcff41e8a533b0865973a15f8/day_01.py

    Shared this site around the office too, it's made us all in the dev team very happy...

  • Here was my final version for day 1. Doesn't cache the entire input so it could happily run on an input with billions of numbers.

    https://gist.github.com/alexgreenbank/fd27d201a2620f3e899df2fdbcd53f59

    (It's fairly minimalist, aiming for the terser end of the spectrum but steering clear of the code golf nonsense that makes it utterly unreadable.)

  • Well the first couple of days were pretty easy with Excel, not sure how long it will be feasible for though if previous years are anything to go by.

  • Haven't written a line of code since last year, but I managed to do day 1 and 2 fairly quickly. Took me a second to get back into it but once I realised I could re-use the importing stuff from last year the rest went quickly. None of it is elegant or efficient but it works.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Advent of Code - adventofcode.com

Posted by Avatar for Drakien @Drakien

Actions