The board


next up previous
Next: The buildings
Up: The game of Traveller (PP)
Previous: The game of Traveller (PP)
Back: to main list of student notes

The board

In the previous section, you saw that Prolog can be used to navigate around structures defined by sets of facts. The following program navigates in a more literal sense. Please start by looking at the file entititled BOARD which comes with this supplement. It defines the basic predicates square, building, joins, in, loop, sells_fuel, buys and sells, plus three ones derived from them: adjacent, clockwise and distance.

Together, these describe a simple street layout, with squares containing shops and fuel stations. Unlike Monopoly, the squares are not confined to the outside of the board, but can form streets, some looped back on themselves, wandering over its interior.

More specifically, the predicates have the meanings given below:

If you care to compare the BOARD file with the diagram of the board, it should become clear what these facts say.


next up previous
Next: The buildings
Up: The game of Traveller (PP)
Previous: The game of Traveller (PP)
Back: to main list of student notes



Jocelyn Paine
Tue Jun 4 17:58:48 BST 1996