The caves world


next up previous
Next: Traveller
Up: Changing the database
Previous: Changing the database
Back: to main list of student notes

The caves world

In the caves world (file DD), assume that each player has his or her own score:

The idea is that this would initially be zero for each player, and would increase with kills, as players wipe out their enemies (how they might do this was described in Supplement 5).

Write and test a predicate called gain(P,N) where P is the name of a player and N is a number. gain must add N to P's score. Thus, gain(fred,20). would up Fred's score from 23 to 43, deleting the old clause for score and adding a new one. We will use this in the next supplement which considers how you might write a complete Adventure game.


next up previous
Next: Traveller
Up: Changing the database
Previous: Changing the database
Back: to main list of student notes



Jocelyn Paine
Tue Jun 4 18:10:48 BST 1996