[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ONELINER TEXTADVENTURE
"Peter Watson" <paw77@N_O_hotmail_S_P_A_M.com> wrote:
>"Chris Cowley" <forename.surname@invalid.grok.co.uk> wrote in message
>1ca9e050j549i22gjrtbt5d9ml54ia7hn2@4ax.com">news:1ca9e050j549i22gjrtbt5d9ml54ia7hn2@4ax.com...
>> And yes, those are references to previously-defined variables in the
>> DATA statement.
>
>Ahh, that explains why (in an earlier post) I thought it might have been
>self-modifying code. By the standards of most BASIC interpreters, it *IS*
>self-modifying!
No, it is not. I made *very* sure to check this point.
The data is read ONCE and never modified. Using variables in the
DATA statements just allows the program source to take less space.
The RESTORE statement is not needed (unless there is a peculiarity in
that BASIC requiring it). The line number is wrong for the RESTORE.
The initialisation of P is not needed either.
The T FOR loop would have been better implemented as a WHILE or
equivalent.
The key to understanding the program is that T is modified by
only one iteration of X and that R$ contains a set of *offsets* for
determining the next state/room. The next state is the current one
plus the ASCII value of the appropriate R$ character minus 47. When
this exceeds eight, the T FOR loop is exited, and the game is over
(win or loss).
Sincerely,
Gene Wirchenko
Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.