News for hackers. Stuff that matters.
Re:Advent of Code 2021 by bussierem on Wednesday December 01, 2021 @10:40AM (#29404786)
I think it's more that the puzzles should avoid having a "correct solution" in the form of a known algorithm. If the puzzle can basically only be solved by remembering a specific algorithm, and any other algorithm (or attempt) will grind for hours, then the puzzle isn't about algorithms, or about coding, it's about whether or not you memorized a part of a math textbook and can recognize that it applies to the problem.

Granted, I don't know the process of AoC in terms of vetting and building their puzzles, but it seems that the person/people involved all share very similar levels and domain of knowledge. Having more people reviewing or involved in the process that have a wider range of skillsets might avoid these situations.

Example from what I was talking about before: Day 13 of AoC2020 was basically "the answer is the Chinese Remainder Theorem". If you remembered that...great you could solve this in 10 seconds (hell some languages have a _function_ for that theorem!). If not....well good luck finding a solution that runs in under 6h. That has nothing to do with _programming_. Its just math, there wasn't even programming involved (literally some solutions were just "parse the input and pass it to mathlib.chinese_remainder()"). That's not satisfying to solve for the majority of people, I feel (opinion, I know).

Re:Advent of Code 2021 by Joker_vD on Wednesday December 01, 2021 @12:18PM (#29406368)
Is this CRT? Not exactly sure, but it does not run for six hours:

    result = 0
    addend = 1

    for divisor, desired_offset in [(7, 0), (13, 1), (59, 4), (31, 6), (19, 7)]:
        # keep trying numbers until we find the one that, with
        # the desired offset added to it, would divide without
        # remainder
        while (result + desired_offset) % divisor != 0:
            result += addend

        # adding another addend should not break previous results
        # so make it divisible by all previous divisors
        addend *= divisor

    result %= 7*13*59*31*19  # Is it really needed? Eh.
    print(result)