Logic Programming

Assignment - Pelican Hunters


This assignment focusses on a simplified version of a board game called Pelican Hunters. There are two parts to the assignment. (1) In the first part, you play the game in order to familiarize yourself with the game world. (2) In the second part, you write rules that constrain the behavior of both players so as to maximize social value while minimally restricting their freedom of action.

Playing the Game

Pelican Hunters is a 2-player, alternating move game played on an 8x8 board. There are two hunters - Indy and Lara. In addition, there are eight pelicans, two pieces of gold, and two diamonds. On each step of the game, one of the players moves to another square. If the player moves onto a square containing the other player, the other player dies. If the player moves onto a square containing a pelican, the pelican is obliterated. If a player moves onto a square containing a diamond or a piece of gold, the treasure is added to the player's hoard. One complication is that a player's hoard has room for only one piece of treasure of each sort. If a player collects a second item of a sort that he or she already has, the treasure disappears (and thus becomes inaccessible to either player). The game terminates when either of the players is eliminated or when all of the pelicans are obliterated. At the end of the game, a player's score is 100 if he or she has both gold and a diamond, it is 50 if he or she has only one type of treasure; and it is 0 otherwise.

Pelican Hunters is not a traditional game. Unlike competitive games, there is also a social score. The social score has two parts - efficiency and equity. The efficiency component is simply the sum of the scores of the players; the higher their scores, the higher the efficiency component. The equity component is the efficiency component multiplied by the difference in the scores of the players divided by 200 (the total possible score). The social score is efficiency minus inequity. If both players get 100 points, efficiency is 200 and inequity is 0 and the societal score is, therefore, 200. If both players get 0, the efficiency is 0 and inequity is 0 and the societal score is 0. If one player gets 100 and the other player gets 0, then efficiency is 100 and inequity is 50 (i.e. 100 * (100 - 0) / 200), and the societal score is 50.

Load the basic version of the game by clicking in the link below. The board is shown in the middle. The social score is shown above the board. The boxes on the left are spaces for Indy's treasure, and the boxes on the right hold Lara's treasure. The scores above these boxes show the scores for each of the players. The currently active player is shown below the board. To make a move, simply click on the desired square. The active player will then move as directed, and the other player will become active.

Pelican Hunters - basic version

If you get tired playing manually, you can let the game play by itself. Clicking on the Step button makes a random move for the active player. Clicking Play runs the game in automatic mode, making random moves for one player after the other. Clicking the Pause button suspend automatic operation. Clicking the Reset button resets the game to its initial state. Try it. You will find a variation of this automatic version useful in the second part of the assignment.

Writing Laws

Now to the point of the assignment. Instead of being a player, you get to play the role of a legislator. Your job is to enact legislation that will allow the players freedom to maximize their individual scores but will encourage them to act so as to maximize the social score as well. What rules would you enact, and how would you encode those rules so that the players used them in determining their legal actions?

As our ontology, we use the symbols a, ..., h to denote columns and the digits 1, ..., 8, as in Chess. We use the symbol indy to denote Indy; we use the symbol lara to denote Lara; and we use gold, diamond, and pelican to denote treasures and pelicans. We use the three place relation location to specify the contents of each location on the board. For example, the sentence location(a,3,indy) means that Indy is located in the third cell (from the bottom) in the first column. We use the two place relation has to state that a player has a particular treasure. For example, the sentence has(indy,gold) means that Indy has a gold nugget. We use the unary predicate control to describe whose turn it is to play. For example, the sentence control(indy) means it is Indy's turn to play. Finally, we use the binary relation legal to state that it is legal for the player in control to move to a specific cell. For example, the sentence legal(a,5) means that it is legal for the currently active player to move to the cell in row and column 5.

Your job on this assignment is to define legal in terms of location and has and control so that all players have maximum freedom but act in a way that maximizes social utility. There are multiple ways this can be done.

Load an editable version of the game by clicking on the link below. This one looks like the one above, but it contains two additional features to help you with your work.

Pelican Hunters - editable version

Below the sheet on the left is a box that shows the data corresponding to the current state of the game. As the players move, the data in this box changes. Note that you cannot modify this data directly.

Below the sheet on the right is a box containing the rules currently associated with the game. Unlike the situation with the data box, you can modify the rules shown here. Simply click in the box and enter your rules. Initially, all moves are legal in all states. Your job with to change this as described above. Once you are happy with your rule set, click Save and the new rules will take effect.

You will note that, as in the basic version of the game, the cursor changes to a pointer as you move over legal destinations for the currently active player. In the basic version of the game, all squares are accessible on all moves. However, in this version of the game, you can define which moves are legal and which are not. The upshot is that some squares are legal destinations and some are not. You will notice that the game indicates legality via the cursor. When the cursor is placed over a legal destination, the cursor is a hand pointer, and you can click there. When the cursor is over a non-legal square, the cursor is something else (depending on your browser), and clicking there has no effect.

When you are done with this part of the assignment, copy and paste your rules into an email and send to the Teaching Assistant. We will evaluate the rules on the basis of correctness (i.e. no syntactic errors, safety, and stratification) and efficacy (whether they result in maximal social value while minimally restricting the behavior of the players).