This is a C# port of the Java port of the BASIC code from "BASIC Computer Games, TRS-80 Edition" by David H. Ahl, (c)1979"
The Java port was done by Alan Hensel and was a lot more effort than my simple C# version, so he deserves the credit for this.
Here's what Alan said about that code:
I created this exercise for myself to push the limits of my refactoring abilities. I put it online because I enjoyed the exercise, and hope that others are similarly masochistic. It increased my confidence that refactoring can fix any code, no matter how bad.
First, I needed a prime example of an incomprehensible knot of spaghetti code, not too large but not too small. Shouldn't be hard to find. Then I would refactor mercilessly and completely untangle it. The idea is similar to the "Obfuscated C++" column from C++ Report, except that instead of trying to comprehend the code, I would try to make it comprehensible.
While looking for such an example, a childhood memory came back to me. About 20 years ago, when I was 13 or 14, I was mystified by a program in a book of BASIC programs. It was 138 lines of mostly GOTO statements, but it reliably drew mazes, with one exit and one way through. At the time, I was mightily impressed. Now, as a professional programmer, I was appalled, and decided to clear up the childhood mystery once and for all.
So if you fancy a refactoring challenge, this could be a good place to start.