Live data from Hacker News

Peter Norvig's “pytudes” for Advent of Code 2020

github.com

1–10 of 96 posts

Re: Peter Norvig's “pytudes” for Advent of Code 2020

#3
This is very well-written code. I don't think anyone would bring into question Norvig's technical skills, but I wouldn't think someone like him would spend much time at his job writing code, or have much free time to program as a hobby.

As someone who aspires to a position similar to Norvig's (directing research at an organization that is frequently applied in real life), I think it's really cool to see him having time to do stuff like this.

Re: Peter Norvig's “pytudes” for Advent of Code 2020

#4
Always look forward to these so I can compare my solutions afterwards. Sometimes it's almost frustrating to see how clean and concise the mess I made could have been, but I do learn a lot. It's like he gets as close to golfing as possible, without the obfuscation.

Too bad he punted on 20... one of the few difficult problems this year. Usually the hard problems are where you really see the contrast between his solutions and the rest of us plebs. Do I sense a hit of frustration in his comment? ;)

"too tedious for too little reward...." "sea monster as characters inelegant"

Re: Peter Norvig's “pytudes” for Advent of Code 2020

#5
How do you algorithmically code like this? In my software engineering career, I am a plumber at best. Would fail hard at anyone who would ask me to code anything more than fizz buzz under time pressure. That said, I've built some incredible production worthy and robust systems that move mountains as a plumber. I am damn good at that.

Re: Peter Norvig's “pytudes” for Advent of Code 2020

#7

How do you algorithmically code like this? In my software engineering career, I am a plumber at best. Would fail hard at anyone who would ask me to code anything more than fizz buzz under time pressure. That said, I've built some incredible production worthy and robust systems that move mountains as a plumber. I am damn good at that.

If you're ok with throwing time pressure out of the equation, then I think the main thing is just an aspiration to find a beautiful solution to a problem, where "beautiful" is being concise, efficient, short (and, rarely, original) in some proportion that suits your fancy.

After that, it's just practice interspersed with data structure and algorithm research.

Re: Peter Norvig's “pytudes” for Advent of Code 2020

#8

How do you algorithmically code like this? In my software engineering career, I am a plumber at best. Would fail hard at anyone who would ask me to code anything more than fizz buzz under time pressure. That said, I've built some incredible production worthy and robust systems that move mountains as a plumber. I am damn good at that.

I'd recommend taking a look at his book Paradigms of AI Programming [0]. It really shows his thought process in developing solutions to problems. The only other way is practice, and in particular practice with languages that offer functional features. Notice his use of lambdas, assignment of existing functions/constructors to more accurate names (Passport instead of dict, day 4), and higher order functions (quantify).

Those are things that really help in algorithmic code by increasing accuracy of the names of things to the application (almost creating a domain specific language).

[0] https://github.com/norvig/paip-lisp

Re: Peter Norvig's “pytudes” for Advent of Code 2020

#9

How do you algorithmically code like this? In my software engineering career, I am a plumber at best. Would fail hard at anyone who would ask me to code anything more than fizz buzz under time pressure. That said, I've built some incredible production worthy and robust systems that move mountains as a plumber. I am damn good at that.

Norvig teaches a really cool, and challenging, class on Udacity called the "Design of Computer Programs"[0] in Python where you can learn his thought process on how to write reliable and beautiful software to solve interesting problems.

[0] https://www.udacity.com/course/design-of-computer-programs--...

Re: Peter Norvig's “pytudes” for Advent of Code 2020

#10

It's heartwarming to see he skipped d20p2.

For me it followed (other than the pattern matching of the sea monster) directly from my backtracking solution to part 1 (versus his solution). One of the cases where doing the first thing that came to mind ("Well, gotta see where all the tiles go to see which are the corners") was the right thing, poor reading comprehension for the win! I specifically missed this line in the problem description which led to his (and many other people's) solutions:

> but the outermost edges won't line up with any other tiles.

Post reply on HN