-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathhtpataic04.html
674 lines (667 loc) · 21.7 KB
/
htpataic04.html
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
<!DOCTYPE html>
<html>
<head>
<title>4. Objects</title>
<link rel="stylesheet" href="htpataic.css" type="text/css" />
</head>
<body>
<table class="contents"><tr><td>
<h4>Contents</h4>
<div><a href="htpataic01.html">1. Introduction</a></div>
<div><a href="htpataic02.html">2. The main loop</a></div>
<div><a href="htpataic03.html">3. Locations</a></div>
<div><b>4. Objects</b></div>
<div><a href="htpataic05.html">5. Inventory</a></div>
<div><a href="htpataic06.html">6. Passages</a></div>
<div><a href="htpataic07.html">7. Distance</a></div>
<div><a href="htpataic08.html">8. North, east, south, west</a></div>
<div><a href="htpataic09.html">9. Code generation</a></div>
<div><a href="htpataic10.html">10. More attributes</a></div>
<div><a href="htpataic11.html">11. Conditions</a></div>
<div><a href="htpataic12.html">12. Open and close</a></div>
<div><a href="htpataic13.html">13. The parser</a></div>
<div><a href="htpataic14.html">14. Multiple nouns</a></div>
<div><a href="htpataic15.html">15. Light and dark</a></div>
<div><a href="htpataic16.html">16. Savegame</a></div>
<div><a href="htpataic17.html">17. Test automation</a></div>
<div><a href="htpataic18.html">18. Abbreviations</a></div>
<div><a href="htpataic19.html">19. Conversations</a></div>
<div><a href="htpataic20.html">20. Combat</a></div>
<div><a href="htpataic21.html">21. Multi-player</a></div>
<div><a href="htpataic22.html">22. Client-server</a></div>
<div><a href="htpataic23.html">23. Database</a></div>
<div><a href="htpataic24.html">24. Speech</a></div>
<div><a href="htpataic25.html">25. JavaScript</a></div>
</td></tr></table>
<h1>How to program a text adventure in C</h1>
<p>
by Ruud Helderman
<<a href="mailto:r.helderman@hccnet.nl">r.helderman@hccnet.nl</a>>
</p>
<p>
Licensed under
<a href="https://github.com/helderman/htpataic/blob/master/LICENSE">MIT License</a>
</p>
<h2>4. Objects</h2>
<p class="intro">
Before we go on,
let me make it perfectly clear I am using the term ‘object’ in a
<a href="http://en.wikipedia.org/wiki/Object_(philosophy)">philosophical sense</a>
here.
It has nothing to do with
<a href="http://en.wikipedia.org/wiki/Object-oriented_programming">object-oriented programming</a>,
nor does it have anything in common with
the ‘Object’ type pre-defined in programming languages like
<a href="http://en.wikipedia.org/wiki/Java_(programming_language)">Java</a>,
<a href="http://en.wikipedia.org/wiki/C_Sharp_(programming_language)">C#</a>
and
<a href="http://en.wikipedia.org/wiki/Python_(programming_language)">Python</a>.
Below, I will define a new
<a href="http://en.wikipedia.org/wiki/Data_type">data type</a>
named <i>object</i>;
any other name will do equally well if you find <i>object</i> to be confusing,
or if it gives a namespace conflict in the programming environment
you are using.
Very well, moving on...
</p>
<p>
Most puzzles in adventure games revolve around
<b>items</b> and/or <b>actors</b>.
Examples:
</p>
<ul>
<li>A key must be found, then used to unlock a certain door.</li>
<li>A guard must be killed, bribed or lured away to gain access to a room.</li>
</ul>
<p>
Naturally, the guard might as well be a dog, troll, dragon or robot.
In this sense,
<a href="http://en.wikipedia.org/wiki/Non-player_character">non-player character</a>
is a common term, but I don’t want to make a distinction
between player and non-player characters
(the guard might well be another player in a multi-player game).
And just ‘character’ is easily confused with a
<a href="http://en.wikipedia.org/wiki/Character_(computing)">character</a>
data type,
so I will stick to ‘actor’.
</p>
<p>
To represent items and actors, we can use a
<a href="http://en.wikipedia.org/wiki/Struct_(C_programming_language)">struct</a>
like this:
</p>
<ul>
<li><b>description:</b>
how the item/actor is described in narrative text output by the program.
</li>
<li><b>tag:</b>
how the item/actor is recognized by the
<a href="http://en.wikipedia.org/wiki/Parsing">parser</a>.
</li>
<li><b>location:</b>
where the item/actor is located.
This is a pointer to a <i>struct location</i>
as defined in the previous chapter.
</li>
</ul>
<p>
<a href="mockmap04.gif" title="Click to enlarge">
<img class="mockmap" alt="Basic map with objects" src="mockmap04.gif" />
</a>
</p>
<table><tr>
<td class="snippet">struct object {
const char *description;
const char *tag;
struct location *location;
}
objs[] = {
{"a silver coin", "silver", &locs[0]},
{"a gold coin" , "gold" , &locs[1]},
{"a burly guard", "guard" , &locs[0]}
};
</td>
</tr></table>
<p>
Notice this data structure is very similar to the array of locations
we made in the previous chapter.
In fact, the two are so similar we can merge them into a single big list
containing locations, items and actors,
and simply refer to all of them as <b>objects</b>.
</p>
<table><tr>
<td class="old snippet">struct object {
const char *description;
const char *tag;
struct <span class="new">object</span> *location;
}
objs[] = {<span class="new">
{"an open field", "field" , NULL},
{"a little cave", "cave" , NULL},</span>
{"a silver coin", "silver", &<span class="new">objs</span>[0]},
{"a gold coin" , "gold" , &<span class="new">objs</span>[1]},
{"a burly guard", "guard" , &<span class="new">objs</span>[0]}
};
</td>
</tr></table>
<p>
Now that there is no separation between objects and locations,
the struct <i>object</i> contains a pointer to itself.
This is nothing exceptional in C: a
<a href="http://en.wikipedia.org/wiki/Linked_list">linked list</a>
works in a similar way, so don’t be alarmed.
</p>
<p>
To make it easier to reference individual objects,
we will define symbolic names for pointers to each element in the array.
</p>
<table><tr>
<td class="snippet">#define field (objs + 0)
#define cave (objs + 1)
#define silver (objs + 2)
#define gold (objs + 3)
#define guard (objs + 4)
</td>
</tr></table>
<p>
Here are a few examples of how to use these pointers.
The first one is an adaption of a code sample from the previous chapter,
displaying the text “You are in an open field.”
</p>
<table><tr>
<td class="snippet">printf("You are in %s.\n", <span class="red">field</span>->description);
</td>
</tr></table>
<p>
The following piece of code will
list all items and actors present in the cave.
</p>
<table><tr>
<td class="snippet">struct object *obj;
for (obj = objs; obj < objs + 5; obj++)
{
if (obj->location == <span class="red">cave</span>)
{
printf("%s\n", obj->description);
}
}
</td>
</tr></table>
<p>
So what is the benefit of having a single big list of objects?
Our code becomes simpler, as many functions (like the one above)
only need to scan through a single list of objects, rather than three lists.
One might argue that this is irrelevant,
since each command applies to one type of object only:
</p>
<ul>
<li>Command <i>go</i> applies to locations.</li>
<li>Command <i>get</i> applies to items.</li>
<li>Command <i>kill</i> applies to actors.</li>
</ul>
<p>
But this separation is hardly realistic, for three reasons:
</p>
<ol type="1">
<li>Some commands apply to more than one type of object,
in particular <i>examine</i>.
</li>
<li>Besides, an adventure that responds to “eat guard”
with “You can’t”, is just plain boring.
Verbs should not discriminate on the type of object.
The perfect adventure is one that returns an imaginative response
for every combination of verb and noun within the game’s vocabulary.
</li>
<li>Some objects may have more than one role in the game. Examples:
<ul>
<li>A little gnome could be both actor and item;
the player can both speak with the gnome and pick him up.
</li>
<li>A giant could be both actor and location;
this time the giant could pick up the player and walk around with him.
</li>
<li><a href="http://en.wikipedia.org/wiki/Aladdin">Aladdin</a>’s
wonderful lamp could be both item and location.
</li>
</li>
</ol>
<p>
With all objects together in one big list, it is tempting to add some
<a href="http://en.wikipedia.org/wiki/Enumerated_type">enum</a>
attribute named ‘type’ to <i>struct object</i>
to help us distinguish between the different types of objects.
However, objects typically have other characteristics that work equally well:
<ul>
<li><b>Locations</b>
are connected by <i>passages</i> (to be introduced in chapter 6).
If an object cannot be reached through a passage, then it is not a location.
It’s that simple.
</li>
<li><b>Items</b>
are the only objects the player can pick up;
courtesy of their <i>weight</i> (an attribute introduced in chapter 10).
</li>
<li><b>Actors</b>
are the only objects the player can talk to, trade with, fight with;
provided of course that they are still alive!
A <i>health</i> attribute (introduced in chapter 10)
is both more appropriate and more versatile than a simple <i>type</i>.
</li>
</ul>
</p>
<p>
There is one more object we will add to the array: the player himself.
In the next chapter, we will see the real benefits of this choice.
For now,
the only difference is in the way the player’s current location is stored.
In the previous chapter,
there was a separate variable <i>locationOfPlayer</i>.
We will drop it,
and use the <i>location</i> attribute of the player object instead.
For example, this statement will move the player into the cave:
</p>
<table><tr>
<td class="snippet"><span class="red">player</span>->location = cave;
</td>
</tr></table>
<p>
And this expression returns
the description of the player’s current location:
</p>
<table><tr>
<td class="snippet"><span class="red">player</span>->location->description
</td>
</tr></table>
<p>
Time to put it all together.
We start with a whole new module for the array of objects.
</p>
<table class="demo">
<tr><th>Sample output</th></tr>
<tr><td>
Welcome to Little Cave Adventure.<br />
You are in an open field.<br />
You see:<br />
a silver coin<br />
a burly guard<br />
<br />
--> go cave<br />
OK.<br />
You are in a little cave.<br />
You see:<br />
a gold coin<br />
<br />
--> go field<br />
OK.<br />
You are in an open field.<br />
You see:<br />
a silver coin<br />
a burly guard<br />
<br />
--> go field<br />
You can't get much closer than this.<br />
<br />
--> look around<br />
You are in an open field.<br />
You see:<br />
a silver coin<br />
a burly guard<br />
<br />
--> quit<br />
<br />
Bye!<br />
</td></tr>
</table>
<table class="code"><tr>
<th>object.h</th>
</tr><tr>
<td>
<ol>
<li class="new">typedef struct object {</li>
<li class="new"> const char *description;</li>
<li class="new"> const char *tag;</li>
<li class="new"> struct object *location;</li>
<li class="new">} OBJECT;</li>
<li class="new"></li>
<li class="new">extern OBJECT objs[];</li>
<li class="new"></li>
<li class="new">#define field (objs + 0)</li>
<li class="new">#define cave (objs + 1)</li>
<li class="new">#define silver (objs + 2)</li>
<li class="new">#define gold (objs + 3)</li>
<li class="new">#define guard (objs + 4)</li>
<li class="new">#define player (objs + 5)</li>
<li class="new"></li>
<li class="new">#define endOfObjs (objs + 6)</li>
</ol>
</td>
</tr><tr>
<th>object.c</th>
</tr><tr>
<td>
<ol>
<li class="new">#include <stdio.h></li>
<li class="new">#include "object.h"</li>
<li class="new"></li>
<li class="new">OBJECT objs[] = {</li>
<li class="new"> {"an open field", "field" , NULL },</li>
<li class="new"> {"a little cave", "cave" , NULL },</li>
<li class="new"> {"a silver coin", "silver" , field },</li>
<li class="new"> {"a gold coin" , "gold" , cave },</li>
<li class="new"> {"a burly guard", "guard" , field },</li>
<li class="new"> {"yourself" , "yourself", field }</li>
<li class="new">};</li>
</ol>
</td>
</tr></table>
<p>
<b>Note:</b>
to compile this module, the compiler <i>must</i> support
<a href="http://en.wikipedia.org/wiki/Constant_folding">constant folding</a>.
This rules out some of the more primitive compilers like
<a href="http://en.wikipedia.org/wiki/Z88DK">Z88DK</a>.
Which is a shame, since that particular compiler might otherwise be used
to port our 1980s-style game to a 1980s-style computer.
</p>
<p>
For most commands (<i>go</i>, to begin with), the following module
is going to help us find the object that matches the noun specified.
</p>
<table class="code"><tr>
<th>noun.h</th>
</tr><tr>
<td>
<ol>
<li class="new">extern OBJECT *getVisible(const char *intention, const char *noun);</li>
</ol>
</td>
</tr><tr>
<th>noun.c</th>
</tr><tr>
<td>
<ol>
<li class="new">#include <stdbool.h></li>
<li class="new">#include <stdio.h></li>
<li class="new">#include <string.h></li>
<li class="new">#include "object.h"</li>
<li class="new"></li>
<li class="new">static bool objectHasTag(OBJECT *obj, const char *noun)</li>
<li class="new">{</li>
<li class="new"> return noun != NULL && *noun != '\0' && strcmp(noun, obj->tag) == 0;</li>
<li class="new">}</li>
<li class="new"></li>
<li class="new">static OBJECT *getObject(const char *noun)</li>
<li class="new">{</li>
<li class="new"> OBJECT *obj, *res = NULL;</li>
<li class="new"> for (obj = objs; obj < endOfObjs; obj++)</li>
<li class="new"> {</li>
<li class="new"> if (objectHasTag(obj, noun))</li>
<li class="new"> {</li>
<li class="new"> res = obj;</li>
<li class="new"> }</li>
<li class="new"> }</li>
<li class="new"> return res;</li>
<li class="new">}</li>
<li class="new"></li>
<li class="new">OBJECT *getVisible(const char *intention, const char *noun)</li>
<li class="new">{</li>
<li class="new"> OBJECT *obj = getObject(noun);</li>
<li class="new"> if (obj == NULL)</li>
<li class="new"> {</li>
<li class="new"> printf("I don't understand %s.\n", intention);</li>
<li class="new"> }</li>
<li class="new"> else if (!(obj == player ||</li>
<li class="new"> obj == player->location ||</li>
<li class="new"> obj->location == player ||</li>
<li class="new"> obj->location == player->location ||</li>
<li class="new"> obj->location == NULL ||</li>
<li class="new"> obj->location->location == player ||</li>
<li class="new"> obj->location->location == player->location))</li>
<li class="new"> {</li>
<li class="new"> printf("You don't see any %s here.\n", noun);</li>
<li class="new"> obj = NULL;</li>
<li class="new"> }</li>
<li class="new"> return obj;</li>
<li class="new">}</li>
</ol>
</td>
</tr></table>
<div class="explanation">
<p>
Explanation:
</p>
<ul>
<li>Line 11-22:
function <i>getObject</i> determines the object that belongs to a given noun.
It returns a pointer to the object with the tag that matches that particular
noun (i.e. for which function <i>objectHasTag</i> returns true).
If no matching tag can be found,
<a href="http://en.wikipedia.org/wiki/Null_pointer#Null_pointer">NULL</a>
is returned.
</li>
<li>Line 24-43:
function <i>getVisible</i> is a convenient wrapper around <i>getObject</i>.
It will output a generic message if no object matches the given noun,
or if the matching object is not visible from where the player is standing.
In either case,
<a href="http://en.wikipedia.org/wiki/Null_pointer#Null_pointer">NULL</a>
is returned to inform the caller that no further action needs to be taken.
</li>
<li>Line 31-37:
the condition that determines whether a specific object is visible
from the player's point of view, consists of 7 rules.
<ul>
<li>Line 31: the player himself. Yes, that is a visible object too.</li>
<li>Line 32: the player’s current location.</li>
<li>Line 33: objects the player is holding.</li>
<li>Line 34: objects present at the player’s current location.</li>
<li>Line 35: any location the player can go to.
Still pretty crude; will be refined in chapter 6.</li>
<li>Line 36: objects inside another object held by player.</li>
<li>Line 37: objects inside another object present at current location.</li>
</ul>
</li>
<li>Line 39:
I deliberately output <i>noun</i> here, not <i>obj->description</i>;
the latter would give away too much of the game.
For example,
the player might make a lucky guess and type “get gold”
without ever having visited the cave (where the gold coin is located).
Replying with “You don’t see <b>a gold coin</b> here”
is like failing to hide the wires suspending the spaceships in a
<a href="http://en.wikipedia.org/wiki/Science_fiction_film">sci-fi movie</a>.
Instead, we just echo the noun entered by the player:
“You don’t see any <b>gold</b> here.”
</li>
</ul>
</div>
<p>
Here is another helper function.
It prints a list of objects (items, actors) present at a specific location.
It is going to be used in function <i>executeLook</i>,
and in the next chapter we will introduce another command that needs it.
</p>
<table class="code"><tr>
<th>misc.h</th>
</tr><tr>
<td>
<ol>
<li class="new">extern int listObjectsAtLocation(OBJECT *location);</li>
</ol>
</td>
</tr><tr>
<th>misc.c</th>
</tr><tr>
<td>
<ol>
<li class="new">#include <stdio.h></li>
<li class="new">#include "object.h"</li>
<li class="new"></li>
<li class="new">int listObjectsAtLocation(OBJECT *location)</li>
<li class="new">{</li>
<li class="new"> int count = 0;</li>
<li class="new"> OBJECT *obj;</li>
<li class="new"> for (obj = objs; obj < endOfObjs; obj++)</li>
<li class="new"> {</li>
<li class="new"> if (obj != player && obj->location == location)</li>
<li class="new"> {</li>
<li class="new"> if (count++ == 0)</li>
<li class="new"> {</li>
<li class="new"> printf("You see:\n");</li>
<li class="new"> }</li>
<li class="new"> printf("%s\n", obj->description);</li>
<li class="new"> }</li>
<li class="new"> }</li>
<li class="new"> return count;</li>
<li class="new">}</li>
</ol>
</td>
</tr></table>
<div class="explanation">
<p>
Explanation:
</p>
<ul>
<li>Line 10:
object <i>player</i> is excluded from the list;
I don’t think the player needs to hear he is present at his own location.
</li>
<li>Line 12-15:
the list starts with a line “You see:”,
but this is not printed until we know for sure at least one object is found.
</li>
<li>Line 19:
the function returns the number of objects in the list.
In this chapter we will not do anything with that return value,
but in the next we will.
</li>
</ul>
</div>
<p>
In <i>location.c</i>,
the implementation of commands <i>look around</i> and <i>go</i>
is adjusted to the new data structure.
The old array of locations is removed,
and so is the variable <i>locationOfPlayer</i>.
</p>
<table class="code"><tr>
<th>location.h</th>
</tr><tr>
<td>
<ol>
<li class="old">extern void executeLook(const char *noun);</li>
<li class="old">extern void executeGo(const char *noun);</li>
</ol>
</td>
</tr><tr>
<th>location.c</th>
</tr><tr>
<td>
<ol>
<li class="old">#include <stdio.h></li>
<li class="old">#include <string.h></li>
<li class="new">#include "object.h"</li>
<li class="new">#include "misc.h"</li>
<li class="new">#include "noun.h"</li>
<li class="old"></li>
<li class="old">void executeLook(const char *noun)</li>
<li class="old">{</li>
<li class="old"> if (noun != NULL && strcmp(noun, "around") == 0)</li>
<li class="old"> {</li>
<li class="new"><span class="old"> printf("You are in %s.\n", </span>player->location->description);</li>
<li class="new"> listObjectsAtLocation(player->location);</li>
<li class="old"> }</li>
<li class="old"> else</li>
<li class="old"> {</li>
<li class="old"> printf("I don't understand what you want to see.\n");</li>
<li class="old"> }</li>
<li class="old">}</li>
<li class="old"></li>
<li class="old">void executeGo(const char *noun)</li>
<li class="old">{</li>
<li class="new"><span class="old"> </span>OBJECT *obj<span class="old"> = </span>getVisible("where you want to go", noun);</li>
<li class="new"><span class="old"> if </span>(obj<span class="old"> == </span>NULL)</li>
<li class="old"> {</li>
<li class="new"><span class="old"> </span>// already handled by getVisible</li>
<li class="new"> }</li>
<li class="new"> else<span class="old"> if </span>(obj->location<span class="old"> == </span>NULL && obj != player->location)</li>
<li class="new"> {</li>
<li class="new"> printf("OK.\n");</li>
<li class="new"> player->location = obj;</li>
<li class="new"> executeLook("around");</li>
<li class="new"> }</li>
<li class="new"> else</li>
<li class="old"> {</li>
<li class="old"> printf("You can't get much closer than this.\n");</li>
<li class="old"> }</li>
<li class="old">}</li>
</ol>
</td>
</tr></table>
<div class="explanation">
<p>
Explanation:
</p>
<ul>
<li>Line 12:
use function <i>listObjectsAtLocation</i> (from <i>misc.c</i>)
to show a list of items and actors present at the current location.
</li>
<li>Line 22:
by using function <i>getVisible</i> (from <i>noun.c</i>),
we have eliminated the loop from function <i>executeGo</i>,
making the code more readable.
</li>
</ul>
</div>
<p>
The modules <i>main.c</i> and <i>parsexec.c</i> remain unchanged;
you can see them in chapters 2 and 3, respectively.
</p>
<p>
Again, feel free to experiment by adding more objects to the array
in <i>object.c</i>.
Do not forget to increase <i>endOfObjs</i> in <i>object.h</i> accordingly,
or the additional objects will be ignored.
</p>
<p>
It is nice to have some items to enrich our virtual environment,
but right now, there is not much we can do with them.
Silver and gold is scattered across the floor, but we cannot even pick it up!
Let’s fix that in the next chapter.
</p>
<hr />
<table class="download"><tr><td>
<a class="button" href="code04/src.zip">⭳ Download source code</a>
<a class="button" href="https://repl.it/github/helderman/htpataic">🌀 Run on Repl.it</a>
</td></tr></table>
<p>
Next chapter: <a href="htpataic05.html">5. Inventory</a>
</p>
</body>
</html>