Trading


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

Trading

To play Traveller, you have to move around the board, making as much profit as possible. It takes some skill to keep going: for example, you must not allow yourself to run out of fuel. But there is a twist. You yourself are not playing Traveller - or not directly. It is your task to program an automatic trader in Prolog, and to give it rules that determine when and where to buy, sell, or move. Once you start your trader off, it must run without any help from you. The only thing you can do is to watch the output: sympathise if it runs out of fuel or money; applaud if it makes a huge profit.

Before showing you how to program a trader, I need to say some more about prices. Goods are bought and sold in ``units''. So a trader may tell Prolog that it wants to buy 20 units of coal, or to sell 100 units of diamonds. To make Traveller more realistic, you can think of these units as being sacks (of coal); individual boxes (for diamonds and televisions); boxes of six (glasses); boxes of twenty-four (peaches). However, it doesn't matter how many things are inside; you can only buy in whole units.

The buying and selling prices given by buys and sells are all quoted as the price per unit.

Products have volumes, measured in cubic feet. These are given by the only fact I haven't yet mentioned: unit_volume(Good,V). V is the volume occupied by one unit of Good (all goods of the same type have the same unit volume - containerisation). This matters because as a trader, you drive a lorry whose size is strictly limited. It has a capacity of 1000 cubic feet. You can always fill it up to this amount, provided you have the money, but you cannot cram in any more above the limit.

When you start off, you are given £5000 in cash, to spend as you will. There is no upper limit on your cash - you can accumulate indefinitely - but you are not allowed to go below zero. There are no credit facilities in this game.

Your lorry has a fuel tank whose capacity is twenty units. When you start off, it is full. At each stage in the game, you are allowed to do one of four things:

Thus, when you move, you can only move to an adjacent square, and then only if it is connected to your current square. Each move costs one unit of fuel, so after twenty moves you will be out of the game unless you remember to refuel.

To buy or sell, you must be on the same square as the person you're dealing with. You can only buy (fuel or tradeable goods) if you have enough money; otherwise you will be thrown out of the game for fraud. If you try to buy more fuel than you have room for in your tank, you will certainly spend the money; your tank will be filled, and any excess will just be spilt. However, if you try to buy more of a good than you have room for, the transaction will be forbidden for safety reasons, and you will be kicked out as an unsafe driver.

You can only sell a good if you have enough of it in your lorry. If you haven't, you will again be thrown out for fraud.


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



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