I am writing a programming language of my own. (I've done two Turing complete ones in the past, but this time I'm trying to actually be useful.)
Now, one thing that should be especially easy with this is interactive fiction.
"Three criminals approach you and accuse you of being a detective (which of course you are). What do you do?" Choice A (pull your weapon) Choice B (accuse someone else) Chioce C (flee)
Right now, I'm just executing choices that the player makes. However, I was thinking of translating my script to Java so you can play this on a website. My approach was going to be recursion.. just execute A, execute all the choices after that until you run out of choices and go to B. Essentially generate a tree. For this kind of a problem, this looks like it would work great. You are just transcribing the problem into
However, this exposes the language to certain ways of solving problems that might lead to more recursion than could have been computed since the start of the known universe. Easily. For example, chess.
I have a subroutine
askMultiple(...) that would offer the player a series of choices. This is where the recursion would take place; every time a choice leads to more choices, just go down the tree.
Now, this would be an unwieldy way to ask for choices on a chess board (its a long list of moves.) But it would be quite logically possible, and maybe less unwieldy than you might think since the language supports custom output modules.
It's easy to handle infinite numbers of input in a finite space (
what is your name?). For example
Hi, detective Ashley, Hi, detective Morris...
but I know that this approach might generate problems.
How can I avoid this?