Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QUEST-A
#1
I literally stumbled across this clicking links a half hour ago. It was originally written for use on the SpectraVideo CompuMate, A system that had maybe 2K of RAM. Other than editing the command words I have done no editing of note.  I did add the comments. Apparently if the original code was 1 or 2 lines larger it would have been too large for the original editor. This is just a little programming archeology.

Code: (Select All)
'QUEST-A
'BASIC PROGRAMME FOR THE SPECTRAVIDEO CompuMate
'AUTHOR: Graham.J.Percy
'25th September, 1998.
'edited to work in QB but otherwise unchanged
1 Q$ = "+---------+"
2 Print Q$, " QUEST-A", Q$, " BY"
3 Print "GRAHAM PERCY", "1=PLAY"
4 Input C
5 R$ = "[ ]"
6 S$ = "+--- ---+"
7 T$ = " ]"
9 V$ = "+---+-+---+"
10 W$ = "[ O++ ]"
11 Y$ = "1=DOWN 2=RIGHT"
12 Print S$, R$, R$, T$, R$, Q$
13 Print "A BIG ROOM", "1=LEFT 2=UP"
14 Input "ACTION=", B
15 If B = 1 Then GoTo 32
16 If B <> 2 Then GoTo 14
18 If K <> 1 Then Print Q$, W$
20 If K = 1 Then Print Q$, R$
21 Print T$, R$, S$, "LONG HALL"
23 Print "1=LEFT 2=DOWN"
24 If K <> 1 Then Print "3=GET KEY"
25 Input "ACTION=", B
26 If B = 2 Then GoTo 12
27 If B = 1 Then GoTo 48
28 If B <> 3 Then GoTo 25
29 If K = 0 Then Print "YOU GOT KEY"
30 Let K = 1
31 GoTo 18
32 Print S$, R$, "[", Q$, "A DARK HALL"
33 If P = 1 Then GoTo 38
34 G = Int(1 + Rnd * 2): F = Int(1 + Rnd * 3)
35 If G <> 2 Then GoTo 38
36 Print "OGRE HERE", "1=UP 2=RIGHT", "3=FIGHT"
37 GoTo 39
38 Print "1=UP 2=RIGHT"
39 Input "ACTION=", B
40 If B = 3 And G = 2 And F = 3 Then GoTo 96
41 If B = 2 Then GoTo 12
42 If B = 1 Then GoTo 48
43 If B <> 3 Then GoTo 39
44 Print "GOT THE OGREGOT ARMOUR"
45 Let P = 1
46 GoTo 32
48 If D = 1 Then If E = 3 Then GoTo 70
49 If D = 0 Then If E = 3 Then GoTo 77
50 Print V$, R$, "[", R$, S$
51 Print "TROLL, DOOR", Y$, "3=OPEN 4=FIGHT"
52 Input "ACTION=", B
53 If B = 1 Then GoTo 32
54 If B = 2 Then GoTo 18
55 If B = 3 Then If K = 1 Then GoTo 60
56 If B = 3 Then Print "NEED A KEY"
57 If B = 4 Then GoSub 88
59 GoTo 48
60 Print "TROL SAY NO"
61 GoTo 48
70 Print S$, R$, "[", R$, S$, "OPEN DOOR", Y$, "3=UP"
71 Input "ACTION=", B
72 If B = 1 Then GoTo 32
73 If B = 2 Then GoTo 18
74 If B <> 3 Then GoTo 71
75 Print "* * *", " *", "", R$, R$, S$, "YOU,RE FREE"
76 GoTo 97
77 Print V$, R$, "[", R$, S$, "A DOOR", Y$, "3=OPEN DOOR"
79 Input "ACTION=", B
80 If B = 1 Then GoTo 32
81 If B = 2 Then GoTo 18
82 If B = 3 Then If K = 1 Then GoTo 85
83 If B = 3 Then Print "NEED A KEY"
84 GoTo 79
85 Print "YOU OPEN IT"
86 Let D = 1
87 GoTo 70
88 If P = 0 Then Let F = Int(Rnd * 1): E = E + 1
89 If P = 1 Then Let F = Int(Rnd * 14): E = E + 1
90 Print "YOU ATTACK,"
91 If F = 0 Then GoTo 96
92 If E = 3 Then Print "GOT HIM"
93 Return
96 Print "HE GOT YOU"
97 Print "BYE"
Reply
#2
Interactive Fiction. Apart from shooting aliens, one of my favourite genre's...  Nicely done...  Three moves into the game... A troll...  you can guess the result... lol

Cool...

J
May your journey be free of incident. Live long and prosper.
Reply
#3
Nice example.

TROL killed me Sad

It looks like there are some display issues in QB64-PE 3.8.0 but it did run Smile

[Image: Screen-Shot-2023-08-16-at-5-33-17-PM.png]
grymmjack (gj!)
GitHubYouTube | Soundcloud | 16colo.rs
Reply
#4
(08-16-2023, 06:42 PM)James D Jarvis Wrote: I literally stumbled across this clicking links a half hour ago. It was originally written for use on the SpectraVideo CompuMate, A system that had maybe 2K of RAM. Other than editing the command words I have done no editing of note.  I did add the comments. Apparently if the original code was 1 or 2 lines larger it would have been too large for the original editor. This is just a little programming archeology.
Code: (Select All)
'QUEST-A
'BASIC PROGRAMME FOR THE SPECTRAVIDEO CompuMate
'AUTHOR: Graham.J.Percy
'25th September, 1998.
'edited to work in QB but otherwise unchanged
1 Q$ = "+---------+"
2 Print Q$, " QUEST-A", Q$, " BY"
3 Print "GRAHAM PERCY", "1=PLAY"
4 Input C
5 R$ = "[ ]"
6 S$ = "+--- ---+"
7 T$ = " ]"
9 V$ = "+---+-+---+"
10 W$ = "[ O++ ]"
11 Y$ = "1=DOWN 2=RIGHT"
12 Print S$, R$, R$, T$, R$, Q$
13 Print "A BIG ROOM", "1=LEFT 2=UP"
14 Input "ACTION=", B
15 If B = 1 Then GoTo 32
16 If B <> 2 Then GoTo 14
18 If K <> 1 Then Print Q$, W$
20 If K = 1 Then Print Q$, R$
21 Print T$, R$, S$, "LONG HALL"
23 Print "1=LEFT 2=DOWN"
24 If K <> 1 Then Print "3=GET KEY"
25 Input "ACTION=", B
26 If B = 2 Then GoTo 12
27 If B = 1 Then GoTo 48
28 If B <> 3 Then GoTo 25
29 If K = 0 Then Print "YOU GOT KEY"
30 Let K = 1
31 GoTo 18
32 Print S$, R$, "[", Q$, "A DARK HALL"
33 If P = 1 Then GoTo 38
34 G = Int(1 + Rnd * 2): F = Int(1 + Rnd * 3)
35 If G <> 2 Then GoTo 38
36 Print "OGRE HERE", "1=UP 2=RIGHT", "3=FIGHT"
37 GoTo 39
38 Print "1=UP 2=RIGHT"
39 Input "ACTION=", B
40 If B = 3 And G = 2 And F = 3 Then GoTo 96
41 If B = 2 Then GoTo 12
42 If B = 1 Then GoTo 48
43 If B <> 3 Then GoTo 39
44 Print "GOT THE OGREGOT ARMOUR"
45 Let P = 1
46 GoTo 32
48 If D = 1 Then If E = 3 Then GoTo 70
49 If D = 0 Then If E = 3 Then GoTo 77
50 Print V$, R$, "[", R$, S$
51 Print "TROLL, DOOR", Y$, "3=OPEN 4=FIGHT"
52 Input "ACTION=", B
53 If B = 1 Then GoTo 32
54 If B = 2 Then GoTo 18
55 If B = 3 Then If K = 1 Then GoTo 60
56 If B = 3 Then Print "NEED A KEY"
57 If B = 4 Then GoSub 88
59 GoTo 48
60 Print "TROL SAY NO"
61 GoTo 48
70 Print S$, R$, "[", R$, S$, "OPEN DOOR", Y$, "3=UP"
71 Input "ACTION=", B
72 If B = 1 Then GoTo 32
73 If B = 2 Then GoTo 18
74 If B <> 3 Then GoTo 71
75 Print "* * *", " *", "", R$, R$, S$, "YOU,RE FREE"
76 GoTo 97
77 Print V$, R$, "[", R$, S$, "A DOOR", Y$, "3=OPEN DOOR"
79 Input "ACTION=", B
80 If B = 1 Then GoTo 32
81 If B = 2 Then GoTo 18
82 If B = 3 Then If K = 1 Then GoTo 85
83 If B = 3 Then Print "NEED A KEY"
84 GoTo 79
85 Print "YOU OPEN IT"
86 Let D = 1
87 GoTo 70
88 If P = 0 Then Let F = Int(Rnd * 1): E = E + 1
89 If P = 1 Then Let F = Int(Rnd * 14): E = E + 1
90 Print "YOU ATTACK,"
91 If F = 0 Then GoTo 96
92 If E = 3 Then Print "GOT HIM"
93 Return
96 Print "HE GOT YOU"
97 Print "BYE"

Silly thing observation I'm wondering about.


From the SpectraVideo CompuMate User’s Manual (p. 29)

The RND (10) instruction tells Compumate™ to pick a number from 0 to 10

Lines 88 and 89 (in the original code) have the two RND statements RND(1) and RND(14).  RND(1) would give either 0 or 1, and RND(14) would give any random number between 0 and 14 inclusive.

In the QB code, doesn't Int(Rnd * 1) always give 0, and doesn't Int(Rnd * 14) always give a number from 0 to 13 inclusive?  So the first one will never give a 1, and the second one will never give a 14?
Reply
#5
(08-17-2023, 12:03 AM)CharlieJV Wrote:
(08-16-2023, 06:42 PM)James D Jarvis Wrote: I literally stumbled across this clicking links a half hour ago. It was originally written for use on the SpectraVideo CompuMate, A system that had maybe 2K of RAM. Other than editing the command words I have done no editing of note.  I did add the comments. Apparently if the original code was 1 or 2 lines larger it would have been too large for the original editor. This is just a little programming archeology.
Code: (Select All)
'QUEST-A
'BASIC PROGRAMME FOR THE SPECTRAVIDEO CompuMate
'AUTHOR: Graham.J.Percy
'25th September, 1998.
'edited to work in QB but otherwise unchanged
1 Q$ = "+---------+"
2 Print Q$, " QUEST-A", Q$, " BY"
3 Print "GRAHAM PERCY", "1=PLAY"
4 Input C
5 R$ = "[ ]"
6 S$ = "+--- ---+"
7 T$ = " ]"
9 V$ = "+---+-+---+"
10 W$ = "[ O++ ]"
11 Y$ = "1=DOWN 2=RIGHT"
12 Print S$, R$, R$, T$, R$, Q$
13 Print "A BIG ROOM", "1=LEFT 2=UP"
14 Input "ACTION=", B
15 If B = 1 Then GoTo 32
16 If B <> 2 Then GoTo 14
18 If K <> 1 Then Print Q$, W$
20 If K = 1 Then Print Q$, R$
21 Print T$, R$, S$, "LONG HALL"
23 Print "1=LEFT 2=DOWN"
24 If K <> 1 Then Print "3=GET KEY"
25 Input "ACTION=", B
26 If B = 2 Then GoTo 12
27 If B = 1 Then GoTo 48
28 If B <> 3 Then GoTo 25
29 If K = 0 Then Print "YOU GOT KEY"
30 Let K = 1
31 GoTo 18
32 Print S$, R$, "[", Q$, "A DARK HALL"
33 If P = 1 Then GoTo 38
34 G = Int(1 + Rnd * 2): F = Int(1 + Rnd * 3)
35 If G <> 2 Then GoTo 38
36 Print "OGRE HERE", "1=UP 2=RIGHT", "3=FIGHT"
37 GoTo 39
38 Print "1=UP 2=RIGHT"
39 Input "ACTION=", B
40 If B = 3 And G = 2 And F = 3 Then GoTo 96
41 If B = 2 Then GoTo 12
42 If B = 1 Then GoTo 48
43 If B <> 3 Then GoTo 39
44 Print "GOT THE OGREGOT ARMOUR"
45 Let P = 1
46 GoTo 32
48 If D = 1 Then If E = 3 Then GoTo 70
49 If D = 0 Then If E = 3 Then GoTo 77
50 Print V$, R$, "[", R$, S$
51 Print "TROLL, DOOR", Y$, "3=OPEN 4=FIGHT"
52 Input "ACTION=", B
53 If B = 1 Then GoTo 32
54 If B = 2 Then GoTo 18
55 If B = 3 Then If K = 1 Then GoTo 60
56 If B = 3 Then Print "NEED A KEY"
57 If B = 4 Then GoSub 88
59 GoTo 48
60 Print "TROL SAY NO"
61 GoTo 48
70 Print S$, R$, "[", R$, S$, "OPEN DOOR", Y$, "3=UP"
71 Input "ACTION=", B
72 If B = 1 Then GoTo 32
73 If B = 2 Then GoTo 18
74 If B <> 3 Then GoTo 71
75 Print "* * *", " *", "", R$, R$, S$, "YOU,RE FREE"
76 GoTo 97
77 Print V$, R$, "[", R$, S$, "A DOOR", Y$, "3=OPEN DOOR"
79 Input "ACTION=", B
80 If B = 1 Then GoTo 32
81 If B = 2 Then GoTo 18
82 If B = 3 Then If K = 1 Then GoTo 85
83 If B = 3 Then Print "NEED A KEY"
84 GoTo 79
85 Print "YOU OPEN IT"
86 Let D = 1
87 GoTo 70
88 If P = 0 Then Let F = Int(Rnd * 1): E = E + 1
89 If P = 1 Then Let F = Int(Rnd * 14): E = E + 1
90 Print "YOU ATTACK,"
91 If F = 0 Then GoTo 96
92 If E = 3 Then Print "GOT HIM"
93 Return
96 Print "HE GOT YOU"
97 Print "BYE"

Silly thing observation I'm wondering about.


From the SpectraVideo CompuMate User’s Manual (p. 29)

The RND (10) instruction tells Compumate™ to pick a number from 0 to 10

Lines 88 and 89 (in the original code) have the two RND statements RND(1) and RND(14).  RND(1) would give either 0 or 1, and RND(14) would give any random number between 0 and 14 inclusive.

In the QB code, doesn't Int(Rnd * 1) always give 0, and doesn't Int(Rnd * 14) always give a number from 0 to 13 inclusive?  So the first one will never give a 1, and the second one will never give a 14?

In QB64 Rnd(n) is worse yet, from wiki:
Quote:Þ Þ  result! = RND [(n)]

Parameters:
ÍÍÍÍÍÍÍÍÍÍÍ
 n is a SINGLE numeric value that defines the behavior of the RND function but is NOT normally required:

Þ Þ  n parameter omitted: Returns next random number in the sequence.
Þ Þ  n = 0: Return the last value returned.
Þ Þ  n < 0: Always returns the same value for any given n
Þ Þ  n > 0: the sequence of numbers generated will not change unless RANDOMIZE is initiated.

Oops I almost missed the point that 1 or 14 are never going to be an option in the OP game.
b = b + ...
Reply
#6
BAM version: QUEST-A, by Graham J. Percy (An ATARI 2600 SpectraVideo CompuMate BASIC program ported to QB, then ported to BAM)
Reply
#7
Oh I could have made a mistake in my conversion but I was able to find the key and get out of the dungeon on the first run, so by the standard of old type the program in from this magazine standard of basic programming it worked. I tried to be as direct as I could. Some of my conversion could indeed be off.  I only suspect my conversion of the if then chain is accurate. I just love seeing the old stuff and getting it to run again.
Reply
#8
This girl? This female thing?

Could only be attacked by a troll. Nice program. I am not capable even of this. I start to plan a text-mode adventure but ambitions and expectations take over too soon.
Reply




Users browsing this thread: 1 Guest(s)