Auraes from over on the CASA text adventures forum put me onto a game for possible porting. He wrote:
“A tiny game found in the French magazine Trace with an esoteric and unreadable source code, but which may be of interest to jgerrie”
Auraes made a transcription of the article available, but acknowledged that there could be some mistakes in the listing. I did find one:
240: G=INT N-10*INT (B/10)
It should have read as:
240: G=INT B-10*INT (B/10)
“Les cavernes” was originally designed for the TRS-80 Pocket Computer. It was a fascinating little program. From my meagre French, it appeared to use a special method of entering the list of descriptions into variable memory. Rather than entering it by a traditional READ/DATA statement approach), to conserve as much memory as possible, it has the user simply enter the list of text descriptions into the array variables by typing them in direct mode. The main program itself is highly condensed using every trick possible in pocket TRS-80 Basic. All this to shoe-horn a simple text adventure game into 4K. So cool. I have tried to get it to work in the 4K space of the unexpanded TRS-80 MC-10.
I had to figure out that for the pocket computer an expression like F=4F is interpreted as F=4*F. This is one of the ways the programmer, Charles Feydy, used to save precious memory.
Here's the link for the original source code in TRACE magazine, page 62 to 63:
Auraes noticed that there seemed to be infinite loop at the heart of the program, that provided no way to jump out of it to the various subroutines of the program. However, the pocket computer turned out to have some ability to auto sense the pressing of “programmable” keys. If a line started with a string of a key
for example, it would be automatically jumped to when that key was pressed. It must have been based on some form of interrupt driven key sensing working in the background while Basic was running.
Auaes tried to reproduce the code using PureBasic, but like me he was having trouble with the memory management of the Pocket computer. He was able to help me figure out that the variables, which could only be single letters, could also be treated as a single digit array. For example, we had both noticed that the variable B was not initialized anywhere in the program when in fact it was being indirectly initialized by references to A(2). So single numeric variables like B equate to ordered array instances of A.
A(1) = A
A(2) = B
A(3) = C
Thanks to Auraes pointing this out to me I finally made some progress converting the program to Micro Color Basic:
The problem is that the game seems very difficult and the map seems basically arbitrary. I’m not sure if there are still bugs in it, that I have somehow missed. I am not sure how it is supposed to be won. So I will keep you folks posted on any progress I make testing them game, and if this reveals any bugs.
Anyone interested can try playing the game here:
Just select CAVERNES from the Cassette menu. It can be a little tricky sometimes to select it. Then type RUN in the main emulator screen and hit Enter.
I translated the game to use English text. I updated the interrupt key sensing to a more standard system using INPUT and the following commands:
The first letter is actually all that is needed. Enjoy.
Auaes posted a response that suggests that the way to "win" is wander and collect keys, that will allow you to kill certain monsters, which is how you earn points. I think there are 10 keys, so conceivably you are playing for the highest score possible. This is likely to be pretty challenging, as you sometimes can find yourself in rooms with no exit, either because there aren't any, or the monster blocks the only exit. At that point it's "game over." However, there is no randomness in the mazes numerically generated from the numbers you enter at game startup in response to the "No" and "Level" prompts. Those numbers determine the maze you get, so there should be room for retrying until you make some progress. Type Q to end the game and see your final score.