Sub Hunt – Commodore 64 – Basic V2

Libro: 24 Tested ready-to-run game programs in basic – Anno: 1978 – Trascrizione: Francesco Fiorentini

Torna il Commodore 64 su RetroLiPS, ma questa volta passiamo da un gioco con grafica, Super Polpetta, ad un gioco tutto testuale ma altrettanto avvincente: Sub Hunt!

Il gioco vi mette contro un sottomarino nucleare nemico in agguato nei mari vicini. L’area di conflitto è una griglia di 10 x 10 unità e il nemico può immergersi fino a una profondità di 10 unità. La Figura 1 vi aiuta a visualizzare l’area di gioco. La vostra missione è distruggere il sottomarino. Avete un numero limitato di cariche di profondità. Questo numero cambia da partita a partita, ma ne avrete sempre almeno 16. Per distruggere il sottomarino, è necessario posizionare la carica non solo sulla giusta coordinata, ma anche alla giusta profondità.

Figura 1

Questo listato é stato pubblicato sul libro 24 Tested ready-to-run game programs in basic, scritto da Ken Tracton ed edito da TAB BOOKS nel 1978.

Titolo: Sub Hunt
Piattaforma: Commodore 64
Linguaggio: Basic V2
Versione originale: Ken Tracton
Pubblicazione: 24 Tested ready-to-run game programs in basic
Anno: 1978
Trascrizione: Francesco Fiorentini
Anno: 2022
Download: Sub Hunt
Note: il listato originale é stato modificato e corretto.

Istruzioni
Questo gioco vi mette contro un sottomarino nucleare nemico in agguato nei mari vicini. L’area di conflitto è una griglia di 10 x 10 unità e il nemico può immergersi fino a una profondità di 10 unità. La vostra missione è distruggere il sottomarino. Avete un numero limitato di cariche di profondità.
Per distruggere il sottomarino dovrete fornire le coordinate dove posizionare la carica, nella forma di x,y e successivamente specificare la profonditá. La carica verrá consumata solo nel caso di profonditá superiore a 0.

Come sempre, qui di seguito trovate il codice ottimizzato per essere copiato direttamente su CBM prg Studio.

Se invece siete ansiosi di provare il gioco su un C64 reale o su un emulatore, scaricate il file Sub Hunt dal nostro sito retromagazine.net.

Attenzione – Ci siamo resi conto che nel listato i caratteri ‘>’ e ‘<‘ potrebbero venir sostituiti dai rispettivi encoding html ‘&gt’ e ‘&lt’. Nel caso, sostituite questi valori nel listato prima di copiarlo sull’emulatore.

Listato:  Sub Hunt – Commodore 64 – Basic V2


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
1 rem the game of sub hunt
2 rem the sub hunt is played
3 rem on a 10 x 10 grid with
4 rem the origin on the left
5 rem top corner.
6 rem the x axis reads from
7 rem 1 to 10 going left to
8 rem right, the y axis reads
9 rem from 1 to 10 going
10 rem top to bottom, therefore
11 rem coordinate 10,10 is the right
12 rem lower corner of the grid
13 rem subs are crafty, watch them
14 rem carefully
20 print"{clear}" : poke 53280,0: poke 53281,0:poke 646,7
21 print"***************************************"
22 print"*                                     *"
23 print"*               sub hunt              *"
24 print"*                                     *"
25 print"***************************************"
26 print
27 print"           original version      "
28 print"        by ken tracton on 1978   "
29 print"  for the book:24 tested ready-to-run "
30 print"        game programs in basic    "
31 print: print: print"{orange}         commodore 64 version"
32 print"         by f. fiorentini"
33 print"         on july 2022"
34 print"         for retrolips project{yellow}"
35 print: print
36 print"     >>> when ready press a key <<<"
37 poke198,0:wait198,1:poke198,0
38 print chr$(147)
190 print "welcome to the game of sub hunt"
200 print ""
210 print "the enemy sub may be lurking"
220 print "anywhere within the grid."
230 print "to complicate finding it and"
240 print "destroying it with depth charges,"
250 print "the sub can also dive."
260 print "depth charges may be dropped"
270 print "anywhere on the grid, but"
280 print "they are not effective unless"
290 print "they have been set for the right"
300 print "depth."
310 print "since the sub can dive to the sea"
320 print "bottom, so can depth charges be"
330 print "set for this depth, 10 is the sea"
340 print "bottom, while 1 is the surface of"
350 print "the sea."
352 print:print:print"     >>> when ready press a key <<<"
355 poke198,0:wait198,1:poke198,0
358 print chr$(147)
360 print "the sub's position will be updated"
370 print "after each move, as it waits to see"
380 print "what your move is."
390 print "the sub, being nuclear powered, can"
400 print "stay at any depth, for any period of"
410 print "time."
420 print "to destroy the sub, you must"
430 print "drop the depth charge not only at"
440 print "the right coordinates, but it must"
450 print "be fused for the right depth."
460 print "if not, you have wasted a depth."
470 print "charge."
480 print "you have a disadvantage and an"
490 print "advantage over the sub."
500 print "the disadvantage is you're limited"
510 print "to the number of depth charges"
520 print "you have, since you have been at"
530 print "sea so long."
532 print:print:print"     >>> when ready press a key <<<"
535 poke198,0:wait198,1:poke198,0
538 print chr$(147)
540 print "the advantage is that the sub can move"
550 print "only one square at a time, and also"
560 print "it can move only up or down in depth"
570 print "one coordinate at a time."
580 rem amount of depth charges
590 c1=int(rnd(0)*11)+16
600 print "good luck, commander."
610 print ""
620 print "you, commander, are at coordinates 1,1"
630 print ""
640 rem set up position for sub
650 a = int(rnd(0) * 10) + 1
660 b = int(rnd(0) * 10) + 1
670 d = int(rnd(0) * 10) + 1
680 rem a is the x axis
690 rem b is the y axis
700 rem d is the depth
710 rem ship's starting coordinates
720 x1 = 1
730 y1 = 1
740 rem get ship's move
750 print ""
760 print "{orange}>> commander, where do we sail for"
765 print ">> provide coordinates as x,y{yellow}"
770 input x,y
780 rem test that x,y are not out of bounds
790 if x >10 or x < 1 then 820
800 if y >10 or y < 1 then 820
810 goto 840
820 print "commander, stay within the grid"
830 goto 750
840 x1 = x
850 y1 = y
860 print ""
870 print "{orange}>> and what setting for depth charges"
880 print ">> a setting of 0 releases no charges"
885 print ">> you have ";c1;" charges left...{yellow}"
890 input c
900 if c = 0 then 960
910 if c > 10 or c < 1 then 930
920 goto 1430
930 print "commander, the sub is in the water"
940 print "neither above the surface, nor below the bottom"
950 goto 860
960 print ""
970 print "the sub is at coordinates:-"
980 print "x = "; a; "y = "; b
990 print "and at a depth of "; d
1000 rem new sub position
1010 al = int(rnd(0) * 2)
1020 b1 = int(rnd(0) * 2)
1030 d1 = int(rnd(0) * 2)
1040 rem check for proper move
1050 rem get negative or positive move
1060 q1 = int(rnd(0) * 2)
1070 q2 = int(rnd(0) * 2)
1080 q3 = int(rnd(0) * 2)
1090 if q1 = 1 then 1120
1100 q1 = -1
1110 goto 1130
1120 q1 = 1
1130 if q2 = 1 then 1160
1140 q2 = -1
1150 goto 1170
1160 q2 = 1
1170 if q3 = 1 then 1200
1180 q3 = -1
1190 goto 1210
1200 q3 = 1
1210 if a + (a1 * q1) > 10 or a + (al * q1) < 1 then 1240
1220 a = a + (a1 * q1)
1230 goto 1280
1240 if a + (al * q1) > 10 then 1270
1250 a = 1
1260 goto 1280
1270 a = 9
1280 if b + (b1 * q2) > 10 or b + (b1 * q1) < 1 then 1310
1290 b = b + (b1 * q2)
1300 goto 1350
1310 if b + (b1 * q2) > 10 then 1340
1320 b = 1
1330 goto 1350
1340 b = 9
1350 if d + (d1 * q3) > 10 or d + (d1 * q3) < 1 then 1380
1360 d = d + (d1 * q3)
1370 goto 1420
1380 if d + (d1 * q3) >10 then 1410
1390 d = 1
1400 goto 1420
1410 d = 9
1420 goto 750
1430 if x=a and y=b and c=d then 1630
1440 print
1450 print "sorry, commander, we have missed"
1460 c1 = c1 - 1
1490 if c1 >0 then 960
1500 print ""
1510 print "sorry, commander, no more depth charges"
1520 print "we cannot get him without charges"
1530 print ""
1540 print "to play again type 1, otherwise 0"
1550 input l
1560 if l = 1 then 1610
1570 print ""
1580 print "the computer knew you were a"
1590 print "landlubber..."
1600 stop
1610 print ""
1620 goto 580
1630 print ""
1640 print "nelson would be proud of you"
1650 print "you got the devil sub."
1660 print "you still have "; c1; "depth charges"
1670 goto 1530
1680 end

Share

3 thoughts on “Sub Hunt – Commodore 64 – Basic V2

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

Questo sito usa Akismet per ridurre lo spam. Scopri come i tuoi dati vengono elaborati.