Hacker News new | ask | show | jobs
by nemo1618 4256 days ago
I tried cleaning it up a bit: https://gist.github.com/lukechampine/f54fce8fd756254cefb2

But the actual meaning of the program is still lost on me. I can only guess it has something to do with parsing files (note the checks for curly braces). Feeding it its own source code produces some output, but I have no idea what it actually modified.

3 comments

It's a solution to CS107 assignment 1 : http://web.stanford.edu/class/cs107/assign1.html
Guess I could have just looked at the URL, huh. Well, it was fun trying to reverse Whitney's code anyhow.

Humorously, it looks like this code would have received a poor grade. It meets just about every standard for low quality outlined here: http://web.stanford.edu/class/cs107/landmarks.html, particularly "Fast code which doesn't work quite right." (Due to an off-by-one error, this code fails to properly reconstruct the example text.)

> Due to an off-by-one error, this code fails to properly reconstruct the example text

What's your example? It seems to work fine to me on "{all is well}{ell that en}{hat end}{t ends well}"

In case anybody is still interested, it's now up on http://kparc.com/cs107/readme
The original is 404ing, do you have a mirror?
That's the original C file, where did your "cleaned-up" version go?