3 ms·
Knuth has a version of this game. Fun read: http://www-cs-faculty.stanford.edu/~knuth/programs/advent.w.gz http://www-cs-faculty.stanford.edu/~knuth/programs/a
by taeric 9y ago
Knuth has a version of this game. Fun read: http://www-cs-faculty.stanford.edu/~knuth/programs/advent.w.gz http://www-cs-faculty.stanford.edu/~knuth/programs/advent.w....
- svat 9y agoNote: Best to run that program through `cweave` and read the typeset output, rather than read the `.w` file directly.
- taeric 9y agoIndeed, I should have mentioned this. Thanks! This is also a chapter in https://smile.amazon.com/Selected-Papers-Games-Lecture-Notes/dp/157586584X/ https://smile.amazon.com/Selected-Papers-Games-Lecture-Notes... I would be lying if I said this was super easy to read. It is easy, though. Not sure if it is a good exposition for literate programming. I certainly like it, but I think I was predisposed to.
- svat 9y agoYeah when reading some of Knuth's literate programs, I get the feeling that they are probably the best possible exposition of programs that are not so good to read. :-) That is, the programs aren't structured modularly like good modern programmers would write (encapsulation, separation of concerns, etc.) — instead they freely use global variables, gotos, etc., in the programming style of the 60s with some of Knuth's idiosyncratic improvements. But given that "bad" program, the one with the globals and the gotos, Knuth's literate programming system produces what is probably the best possible exposition of that program — at least for reading as printed material (on paper not on screen).
- taeric 9y agoI actually have grown to like globals because of this writing style. I'll note that most of what he writes is self contained in the section they are in. However, some things require you to have knowledge of how the system works. You can try and limit this from folks locally, but you wind up having confusing state passing tricks that can, amusingly, lead to bugs.
- teddyh 9y ago“What a thrill it was when I first got past the green snake! Clearly the game was potentially addictive, so I forced myself to stop playing — reasoning that it was great fun, sure, but traditional computer science research is great fun too, possibly even more so.” I wish more people had this attitude to distracting things.
- taeric 9y agoWhich aspect? The respect, or the interest in research that equaled it? :) I suspect you mean both. And I agree. I'd probably agree with all permutations of meaning here, actually.