[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ONELINER TEXTADVENTURE
Chris Cowley <forename.surname@invalid.grok.co.uk> wrote:
>On Thu, 01 Jul 2004 17:01:30 -0700, Gene Wirchenko <genew@mail.ocis.net>
>wrote:
[snip]
>> Could you please convert to a more general dialect? What is
>>CODE()? And is that really a variable in a DATA statement?
>
>CODE() is pretty-much the Sinclair BASIC equivalent of ASC(). It returns
>the numeric character code of the first character in the supplied string
>parameter. For the most part, the values returned coincide with ASCII
>for characters in the range 0 to 127, the ZX Spectrum has it's own
>peculiar set of extended characters in the range the 128 to 255.
>
>And yes, those are references to previously-defined variables in the
>DATA statement.
>
>It's a clever bit of work by Mr.Koelman and no mistake!
Truly. I converted it to GW-BASIC, and it took some doing.
There were interesting differences between the BASICs. I did not
totally clean up the code. There is still the modification of a
FOR-loop variable.
Here is my conversion:
10 OPTION BASE 1
20 DIM P$(10)
30 DIM R$(10)
40 C$=CHR$(13)
50 A$="You are in a room."+C$+"You see"+C$+"north: an open
door"+C$+"south: an open door"+C$+"a book about timetravela
timetravelmachine"
60 ' 000000000000000000 0 0000000 0 0000000000000000000 0
0000000000000000000 0 000000000000000000000000000000001111111111
70 ' 000000000111111111 1 2222222 2 2233333333334444444 4
4455555555556666666 6 667777777777888888888899999999990000000000
80 ' 123456789012345678 9 0123456 7 8901234567890123456 7
8901234567890123456 7 890123456789012345678901234567890123456789
90 P$(1)=LEFT$(A$,35)+" locked door"+MID$(A$,67,24)
100 R$(1)="///0"
110 P$(2)=LEFT$(A$,46)+MID$(A$,67,24)
120 R$(2)="0.//"
130 P$(3)=LEFT$(A$,67)+"a key"
140 R$(3)="05//"
150 P$(4)=LEFT$(A$,67)+MID$(A$,91)
160 R$(4)="440/"
170 P$(5)=P$(4)
180 R$(5)="30//"
190 P$(6)=LEFT$(A$,55)+" locked door"+C$+"a key"
200 R$(6)="2/02"
210 P$(7)=P$(3)
220 R$(7)="0111"
230 P$(8)=P$(4)
240 R$(8)="1000"
250 P$(9)="You broke timetravelrules!"
260 R$(9)="////"
270 P$(10)="You found an exit"
280 R$(10)="////"
290 FOR T=1 TO 8
300 CLS
310 PRINT P$(T),,T-(T>4)*5;":00"
320 INPUT A$
330 FOR X=1 TO 4
340 T=T+(ASC(MID$(R$(T),X,1))-47)*-(LEFT$(A$,1)=MID$("NSUR",X,1))
350 NEXT X
360 T=T-1
370 NEXT T
380 PRINT P$(T)
The commands are N, S, U, and R. Only the first character is
used, and only upper case is recognised.
The solution to the game is
H
I
D
D
E
N
B
Y
S
P
O
I
L
E
R
S
P
A
C
E
T
O
P
R
O
T
E
C
T
Y
O
U
and is R, N, N, U, S, U, N, N.
Sincerely,
Gene Wirchenko
Computerese Irregular Verb Conjugation:
I have preferences.
You have biases.
He/She has prejudices.