Why don't you try poking your eye with a sharp stick? It should be a more pleasurable way of spending your time
I'm not DiTBho, but I have this horribly annoying flaw that I tend to say "No problem!" when I mean "I can't give any guarantees, but heck, I'll have a go at it!".
More than once, this has lead me to do stuff that was less fun than sanding my eyeballs with sharp shards of glass.
What I have learned, is how useful documentation describing the overall purpose and algorithms implemented is.
Instead of killing oneself slowly by trying to work with such codebases, one can just rewrite the whole mess, preferably fixing any inefficient/unwanted behaviour at the same time.
My own code, I've learned to write in modules, mostly so that I can replace/rewrite/reuse the useful bits, without doing everything from scratch. By "modules", I mean in adaptable units, as compared to "fixed" libraries. Nowadays, I experiment with a lot of algorithms and possible approaches to answering interesting questions by writing the core part in such a module, then a set of unit tests to verify its behaviour.. and only if successful, move the module into library form for others to play with. I often do 2-3 before I find the approach whose efficiency and behaviour I'm happy with. I find it fun; I'd love to do that as a job.