• Avicenna@programming.dev
    link
    fedilink
    arrow-up
    14
    ·
    13 hours ago

    I mean, if you are interested in AI development and what not I understand why you would want to use something like AoC to test your model.

    But if you were one of those people who used AI to get a high score in global leader boards by getting a solution in microseconds, then you are just a fuckwad. Not essentially any different from Elon who hired someone else to play online games with his account. Thank you for your attention to this matter.

    • Nuclear Oatmeal :paranoid:@beige.party
      link
      fedilink
      arrow-up
      1
      ·
      13 hours ago

      @Avicenna @cm0002

      To be honest, I’m kind of curious as to how that would actually work, but I put in the cranky sleep deprived code. Example being my solution for yesterday. Big ass lookup dictionary for part 2 because it was late.

      Maybe I’ll try it after I’ve got all my stars.

      A minimized capture of C# code to solve Problem 2 for 2026 Advent of Code. The top is a big lookup dictionary for part 2. Buried at the bottom is a main function, then a couple lines for solution 1, then a slightly bigger version to count all the letters and determine the map. Following is a 1 liner LINQ expression to walk an actual "map".

  • chunes@lemmy.world
    link
    fedilink
    arrow-up
    20
    ·
    15 hours ago

    I like this part of Advent of Code’s about page:

    Should I use AI to solve Advent of Code puzzles? No. If you send a friend to the gym on your behalf, would you expect to get stronger? Advent of Code puzzles are designed to be interesting for humans to solve - no consideration is made for whether AI can or cannot solve a puzzle. If you want practice prompting an AI, there are almost certainly better exercises elsewhere designed with that in mind.

  • Buddahriffic@lemmy.world
    link
    fedilink
    arrow-up
    30
    arrow-down
    1
    ·
    19 hours ago

    I bet if this guy got one of those word puzzle books, he’d use the answer keys in the back to “solve” the puzzles and then brag about how easy they are.

  • PineappleProdigy@lemmy.zip
    link
    fedilink
    arrow-up
    6
    ·
    14 hours ago

    How difficult is this advent of code for a college student that’s has been introduced to c, java, js, react, c#? It sounds fun.

    • voldage@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      13 hours ago

      Depends on what “introduced” means, but first 2-3 days usually are easy enough for someone who only recently started learning to get through. The difficulty ramps up, but if you grasp dijkstra algorythm and memoization, you should have most of the tools to clobber together a working solution for most of days, with exception of some more fucked up. It’s more of a puzzle that you answer with code rather than a complex coding challenge (for the most part). I’ve had someone without any IT adjacency describe their way to get a solution for a task after a few hours of head scratching, that a senior web dev I worked with struggled with for over a day. I can recommend, it’s very fun, and only you can save those Elves from otherwise guaranteed doom. No shame stopping midway through and picking it up later, though.

  • threeonefour@piefed.ca
    link
    fedilink
    English
    arrow-up
    74
    ·
    23 hours ago

    I love how easy it is to eat my advent chocolates this year by asking someone else to eat them for me

  • Pup Biru@aussie.zone
    link
    fedilink
    English
    arrow-up
    8
    ·
    16 hours ago

    prompting every day? pft please he needs to build his agentic software factory better so he can slop 365 days per year without even typing

  • xthexder@l.sw0.com
    link
    fedilink
    arrow-up
    10
    ·
    17 hours ago

    I solved day 1 on my phone using a spreadsheet. So far they have been pretty simple. I’m tempted to try solving each day with a different language/system. No AI allowed on my advent train

      • 14th_cylon@lemmy.zip
        link
        fedilink
        arrow-up
        29
        ·
        24 hours ago

        how would you know?

        write something funny regarding <list of topics>. include small typo to make it look more human.

        • Clent@lemmy.dbzer0.com
          link
          fedilink
          English
          arrow-up
          2
          ·
          10 hours ago

          I’ve actually noticed posts with hints of this elsewhere on the internet.

          The errors are atypical of what a human might type and the issues are something a basic autocorrect would have fixed.

    • boonhet@sopuli.xyz
      link
      fedilink
      arrow-up
      15
      arrow-down
      2
      ·
      1 day ago

      This is a group chat, not something super official like a xitter post or something

      Probably typed from a phone too

  • Victor@lemmy.world
    link
    fedilink
    arrow-up
    13
    ·
    22 hours ago

    Doing this year in OCaml again. It’s so freaking great. It’s like the language is built for this kind of linear data processing. Loving it.

      • Victor@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        15 hours ago

        I’ve seen some J code, yeah, it’s pretty freaking terse indeed!

        One drawback with extreme terseness I suppose is that if I come back to a program 6 months later, I’m probably not going to understand much at a glance, so to speak. 😅

        I’d be excited to see your solutions for this year though!

        • brennesel@discuss.tchncs.de
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          5 hours ago

          That’s true. The more concise the solution, the harder it is to understand and remember. Even if you came up with it yourself. That’s why I’ve included explanations for my solutions below.

          On Day 1, a list of numbers had to be sorted by how frequently each number appeared. The three most frequent numbers should then be multiplied together.

          In awk, this is quite simple:
          awk '{s[$1]++}END{for(i in s)print s[i],i}' in | sort -nr | awk -vp=1 'NR<4{p*=$2}END{print p}'
          (in is the file containing the numerical values)

          • Create an array with the number of values
          • Print the number of values and the values themselves
          • Sort in descending order by frequency
          • Filter the first 3 values
          • Multiply them together

          In J, it’s much easier if you pass the values as a list:
          */3{.(~.\:#/.~) in

          • #/.~ displays the frequency of the numbers
          • ~. displays a list of the different values
          • \: sorts the values in the list on the right in descending order and displays the values from the list on the left
          • 3{. takes the first 3 elements of the list
          • */ multiplies all elements of the list

          Part 2 of Day 1 is trivial, since you just need to reverse the sorting order.
          So use sort -n instead of sort -nr for the awk solution, and /: instead of \: for the J solution.

          Day 2 is already a tiny bit more interesting. The task was to calculate the distance for a defined sequence of colors.

          Here’s how I solved it in awk:
          echo "groovyyoyo" | fold -w1 | awk -vl=1 '{i=index("roygbv",$1);s+=(i-l+5)%6+1;l=i}END{print s}'

          • For line-by-line processing in awk, the string is split into lines using fold -w1
          • Determine the index of the current character
          • Subtract the distance from the last character (l starts at 1)
          • Modulo 6 accounts for the fact that the sequence starts with r again after v; adding 5 prevents negative values
          • Add 1 at the end so that the values range from 1 to 6 instead of 0 to 5
          • All values are added up continuously, and the sum is printed at the end

          In J, the same algorithm can be used and looks like this:
          +/1+6|5+(}.-}:)0,'roygbv'i. in

          • 'roygbv' i. determines the index (starting at 0)
          • 0, adds the initial value 0 to the front
          • (}.-}:) is the difference between two consecutive list elements
          • 5+ adds 5 to each element
          • 6| calculates modulo 6 for each element
          • 1+ adds 1 to each element
          • +/ sums all elements

          Part 2 has the greatest potential for optimization so far. The goal is to get the greatest possible distance.

          First, I counted how often each letter appeared and subtracted the distance only at the transitions between colors:
          echo "roygbv" | fold -w1 | awk -vl=1 '{x[index("rvbgyo",$1)]++}END{for(i in x){s+=(6*x[i]-i+l);l=i}print s}'

          • In the array, I counted how often each letter appears
          • One trick is that I get the distance directly by reversing the list of color values and using the index
          • Then I take advantage of the fact that the for loop outputs the indices in ascending order, so that I can start with r for the longest distance and then work through the colors from the end
          • For each color, I calculate the number count * 6 minus the distance to the previous color to determine the color transitions
          • Finally, print the sum

          Then I realized that, in the end, it doesn’t matter at all how many different colors there are. The only thing that matters is which one is farthest from r. So you just need to subtract that maximum distance, and otherwise you can always assume a distance of 6 for each element.

          That makes it even easier:
          echo "groovyyoyo" | fold -w1 | awk '{i=index("rvbgyo",$1)-1;m=i>m?i:m}END{print 6*NR-m}'

          • m=i>m?i:m determines the maximum index (starting at 0)
          • 6 * NR - m calculates 6 times the number of numbers in the list minus the maximum distance from r

          The same procedure is even shorter in J:
          ((6*#)-[:>./'rvbgyo'&i.) in
          • >./ determines the maximum index
          • [: in J ensures that the function on the left-hand side receives the same input, i.e. the number list
          • 6*# determines the number of elements in the list and multiplies it by 6
          • Finally, the difference between the two values is calculated

          I can hardly imagine a shorter solution.

          But now I’m curious how your solutions look like in OCaml.