I saw your question and immediately went ahead and translated the original NIBBLES.BAS directly into C#.
Of course, the code is full of Basicisms; in particular, arrays start at 1. I have changed the sammy
and colorTable
arrays so that they start at 0, but not the arena
array (this one now has an unused index 0
).
Many things could be done more “properly” in C# (e.g. one should probably use enums instead of the numbers 1,2,3,4 for directions up,down,left,right; one should use the ConsoleColor
enum instead of integers for the colors).
I did use a few C#isms though: the sparkle effect on the initial screen is done in a separate thread so that I can just use Console.ReadKey()
to wait for user input.
I had to comment out the code that sets/unsets Num Lock, Caps Lock and Scroll Lock because C#’s Console
only lets me read the state of those, not change them. I would have had to use WinAPI for this, which I decided would have been over the top.
All the comments are from the original.