What are you coding?

My neighborhood has a yearly tradition of doing a bicycle parade on Independence Day. One of the residents usually rides his motorcycle and performs the role of the grand marshal.

I questioned why there needs to be a motorcycle at all- the surprising answer was that a lot of the neighborhood boys like to race and the motorcycle is able to set a pace they can compete to maintain.

Races are fine. But let things be parades, too.

2 Likes

Looks as though https://everybody.codes/ is going to be running again from Monday.

(I have no interest in racing and the puzzles tend to come out at inconvenient times for me anyway.)

2 Likes

Considering the day I had… it is not surprising that part 2 of Day 1 of Advent of Code took me hours to figure out. I solved part 2 half asleep … I guess that’s something, too.

What is not helping is that the auto-complete of my IDE almost solved part 1 on its own without me telling it about the actual puzzle (and i doubt the chatbots can get the solutions that are published today into their models this fast)

So my brain went on auto-pilot. For part 1. And then for part 2 I had not really thought the problem through I had just sleep-walked my way through some object orientation that more or less told the IDE what it was supposed to program.

But part 2 is confusing enough that the auto completion cannot solve it. Yay for confusing problems.

Because I had not thought it through … and additional object oriented programming was not going to crack it… it took me very needlessly long.

I ended up creating a parameterized unit test to debug the thing. I only solved it however when I added a test-case beyond the websites example … not because I had not thought of it before but because when I saw the result my brain’s pattern matching realized what I had been doing wrong with the failing test cases (yes half asleep it still works, maybe I usually imagine I am sleeping)

    @ParameterizedTest()
    @CsvSource({"L68,1,82","L30,0,52","R48,1,0","L5,0,95","R60,1,55","L55,1,0","L1,0,99","L99,1,0","R14,0,14","L82,1,32","L300,3,32"})
    public void testSomething(String turnAsString, int zeroesExpected, int valueExpected){
        ...
        Assertions.assertThat(dial.value).isEqualTo(valueExpected);
        Assertions.assertThat(zeros).isEqualTo(zeroesExpected);
    }

I software-developed my way through the problem or what I call “brute force problem solving by way of endless test cases”

Solution.

2 Likes

For me it was the classic AOC Day 1, whereby I started with Part 1 assuming that Part 2 would just blow the scale out of the water, so I did the usual math trickery most anybody (well, most anybody prone to doing a coding Advent Calendar) would do.

And then Part 2 made me stop and blink exactly 3 times, once for each time my brain spun around in my head – not because Part 2 was mind-altering on its own… but rather, I couldn’t easily slot into my brain the mathematical model to account for the new wrinkle.

And so, as with many of these… I resorted to some brutish force… or… at least… a bit of deoptimization, because the scale was entirely doable in less than a second.