|
Post by tsh73 on Feb 28, 2020 1:25:16 GMT -5
Found on a facebook BASIC Programming Language Public Group | FacebookA link to video Tiny Adventure 10 Line Basic Game Ported to Atari from ZX81
code from the link (ATARI BASIC) 1 DIM X$(150):X$=" CANNOT DOYOU WALK OPENED CLOSED A SWORD A KEY NOTHING A CHEST A DRAGON A CORPSE " 2 DIM U$(15),L$(20):LET R=1:LET C=0:LET I=0:X$(LEN(X$)+1)="TAKEN YOU DIED YOU WON. " 3 LET L$="CAVEPIT HALLLAKE":PRINT "YOU ARE IN A ";L$(R*4-3,R*4):INPUT U$ 4 M=2*(U$="NORTH")*(R<3)-2*(U$="SOUTH")*(R>2)+(R=2 AND U$="WEST")-(R=3 AND U$="EAST") 5 LET A=(3+C+2*(I=2))*(R=2 AND U$="LOOK CHEST")+(11+(I=2))*(R=3 AND U$="KILL DRAGON")+(M<>0) 6 LET A=A+(5+R)*(U$="LOOK")+(6-I)*(U$="INVENTORY")+(6-(I=0))*(R=4 AND U$="LOOK CORPSE") 7 LET B=100*R+10*C+I:A=A+10*(B=400 AND U$="GET KEY")+2*(B=201 AND U$="OPEN CHEST")+10*(B=211 AND U$="GET SWORD") 8 LET R=R+M:C=C+(A=2):I=I+(A=10) 9 PRINT "> ";U$:? X$(A*9+4,A*9+12) 10 IF A<11 THEN GOTO 3 Of cource it doesn't compile in LB. So, as Judge Dredd put it:
|
|
|
Post by sarossell on Feb 28, 2020 3:41:17 GMT -5
Wow! Really cool.
I started on this before I realized it was WAY past my bedtime. So, this code doesn't work, but it does break down the functions in LB terms and replaces the oddly spaced words with comma-delimited phrases referenced using the WORD$ command, but I didn't get to reworking the formulas to calculate the word positions instead of the string length positions.
I'm going to bed! {|@() <== Yawning.
R=1:C=0:I=0 X$="CANNOT DO,YOU WALK,OPENED,CLOSED,A SWORD,A KEY,NOTHING,A CHEST,A DRAGON,A CORPSE,TAKEN,YOU DIED,YOU WON" L$="CAVE,PIT,HALL,LAKE" [REPORT] PRINT "YOU'RE IN A ";WORD$(L$,R,","):INPUT U$
M=2*(U$="NORTH")*(R<3)_ -2*(U$="SOUTH")*(R>2)_ +(R=2 AND U$="WEST")_ -(R=3 AND U$="EAST")
A=(C+2*(I=2))*(R=2 AND U$="LOOK CHEST")_ +(11+(I=2))*(R=3 AND U$="KILL DRAGON")_ +(M<>0)+(5+R)*(U$="LOOK")_ +(6-I)*(U$="INVENTORY")_ +(6-(I=0))*(R=4 AND U$="LOOK CORPSE")
B=100*R+10*C+I:A=A+10*(B=400 AND U$="GET KEY")_ +2*(B=201 AND U$="OPEN CHEST")_ +10*(B=211 AND U$="GET SWORD")
R=R+M:C=C+(A=2):I=I+(A=10)
PRINT "> ";U$ PRINT WORD$(X$,A,",")
IF A<11 THEN GOTO [REPORT]
|
|
|
Post by tsh73 on Feb 28, 2020 6:00:40 GMT -5
The interesting thing is - we see in code * locations * commands * responses But there do they store the MAZE?
(BTW with minor modification via MID$() it happen to run as is, with counted spaces, just fine)
|
|
|
Post by Rod on Feb 28, 2020 7:43:36 GMT -5
The maze is in the layout of the locations is it not? A few changes to the string slicing of L$ and X$ gets it running.
1 X$=" CANNOT DOYOU WALK OPENED CLOSED A SWORD A KEY NOTHING A CHEST A DRAGON A CORPSE " 2 dim U$(15),L$(20):R=1:C=0:I=0:X$=X$+"TAKEN YOU DIED YOU WON. " 3 L$="CAVEPIT HALLLAKE":PRINT "YOU ARE IN A ";mid$(L$,R*4-3,4):INPUT U$ 4 M=2*(U$="NORTH")*(R<3)-2*(U$="SOUTH")*(R>2)+(R=2 AND U$="WEST")-(R=3 AND U$="EAST") 5 A=(3+C+2*(I=2))*(R=2 AND U$="LOOK CHEST")+(11+(I=2))*(R=3 AND U$="KILL DRAGON")+(M<>0) 6 A=A+(5+R)*(U$="LOOK")+(6-I)*(U$="INVENTORY")+(6-(I=0))*(R=4 AND U$="LOOK CORPSE") 7 B=100*R+10*C+I:A=A+10*(B=400 AND U$="GET KEY")+2*(B=201 AND U$="OPEN CHEST")+10*(B=211 AND U$="GET SWORD") 8 R=R+M:C=C+(A=2):I=I+(A=10) 9 PRINT "> ";U$;"?";mid$(X$,(A*9)+4,9) 10 IF A<11 THEN GOTO 3
|
|
|
Post by sarossell on Feb 28, 2020 8:06:58 GMT -5
Sure, but it's sloppy and contrived; limited by Atari's odd restrictions. If the goal is to just get the code to work in LB, that's cool.
|
|
|
Post by Rod on Feb 28, 2020 9:53:02 GMT -5
Yes, and so obfuscated it’s pretty useless for anything other than it is. A neat little adventure engine would be cool. Something folks can understand and expand.
|
|
|
Post by sarossell on Feb 28, 2020 15:05:33 GMT -5
Yes, and so obfuscated it’s pretty useless for anything other than it is. A neat little adventure engine would be cool. Something folks can understand and expand.
|
|
|
Post by Carl Gundel on Feb 28, 2020 15:09:42 GMT -5
Yes, and so obfuscated it’s pretty useless for anything other than it is. A neat little adventure engine would be cool. Something folks can understand and expand. Do you know Telengard? It might be fun to implement something like that in LB.
|
|
|
Post by Carl Gundel on Feb 28, 2020 15:11:47 GMT -5
You posted a link about a video that I posted about from the BASIC language Facebook group that I moderate. You didn't realize that is one of my Facebook groups?
|
|
|
Post by Rod on Feb 28, 2020 15:15:57 GMT -5
Classic text based adventures. I have a couple of old projects that need rescuing. But making it visual and interactive enough for modern users! I had a plan once, it was for an interactive book. The text was supposed to change depending on choices. Must pull it out the drawer.
|
|
|
Post by sarossell on Feb 28, 2020 15:24:13 GMT -5
I think so. Did it use simple text blocks to draw maps and list stats on the right side? I think I played it on a Kaypro back in high school around '83. Fun game as I recall.
:@)
|
|
|
Post by tsh73 on Feb 28, 2020 15:46:13 GMT -5
How you think I found it? Tried to find group you mentioned (and until I mentioned your name I could not find anything) No, I had no idea who posted that link. For me all that stuff on a group page looks totally unstructured, I will hardly ever visit it again.
|
|
|
Post by tsh73 on Feb 28, 2020 15:49:43 GMT -5
|
|
|
Post by Carl Gundel on Feb 28, 2020 15:52:39 GMT -5
How you think I found it? Tried to find group you mentioned (and until I mentioned your name I could not find anything) No, I had no idea who posted that link. For me all that stuff on a group page looks totally unstructured, I will hardly ever visit it again. LOL Yeah, Facebook groups are essentially just a stream of unstructured content, as you said.
|
|
|
Post by Carl Gundel on Feb 28, 2020 15:53:52 GMT -5
I think so. Did it use simple text blocks to draw maps and list stats on the right side? I think I played it on a Kaypro back in high school around '83. Fun game as I recall. :@) There probably was a CP/M version as you describe. The one I played is for the C64 and has some simple color graphics and atmospheric music. It is written in BASIC.
|
|