You have been asked to write a computer version of the Paths and Pipes
board game, by Ian Ross and Chris Saunders of Christchurch1. It is a
simple two player game, where you try to connect your paths, or pipes,
to the other side of the board, while simultaneously stopping your
opponent from connecting their pipes, or paths, to your side.
In Paths and Pipes, the game starts with one pipe card and one path card
in the centre of the board. The half of the board closest to you is your
territory. The other half of the board is where you need to build a
continues pipe, or path, of numbered cards to the opposite edge.
You have a hand of 6 cards. Each turn you place 2 cards, and then
replenish your hand. You can place any card next to a numbered card.
On the opponent’s side of the board, you can only place a card if you can
draw a continuous path, or pipe, from the new card back to your side of
the board. You can place a card on top of an existing card only if it has a
If a path, or pipe, connects back to your half of the board through only
numbered cards, then it is a valid path. If you manage a valid path all the
way to the opposite side of the board, you have won. The path does not
have to be direct, but it cannot be blocked by any obstacles. You can
place an obstacle instead of a card on your turn, which is either a
permanent blocker (boulder) or adds a stack of 4 obstacles to a card.
Each subsequent turn, a player can remove an obstacle from the stack.
When all 4 obstacles have been removed, that path, or pipe, is no longer
blocked (treat the card as of number 0).
The full rules are in the paths+[login to view URL] file.
1 See [login to view URL]
Your program should implement the game where the user plays against a
A computerised version of this game will need a robot player to play
against. At each turn the robot player needs to choose which card to
place and where. The robot player must only make legal moves.
A purely random robot player would not be that interesting to play
against. So, your robot player should try to have some artificial
intelligence, or ‘heuristics’. Should your robot play the lowest numbered
or highest numbered cards first. Should your robot play the blockers
early, or only when the opponent is one card from victory?
Is the computer a ‘safe’ player, playing mostly blocking cards, or are
they ‘offensive’ and placing cards that progress their path further.
Getting the computer to play differently depending on what the board
looks like would be ideal, or let the user choose from different ‘bots’.
Write a program that satisfies the specifications described above. It
should make use of the programming features that you have learnt so far,
in particular using classes, subclasses and methods to structure your
For ease/speed of testing, we recommend you only make the board 4, or
3, or even 2, deep, i.e. you only have to make the path 4 (or 3, or 2) cards
from your side of the board.
The project requires you to both get it verified in the lab and to hand in
the source code. Half of the grade will be based on how the program
runs and half on the structure, code style, documentation and user
We suggest that you build a simplified version of the game first, and then
add in more features as time permits. Concentrate on getting the objects
and simple turn play right before adding fancy graphics and controls. It is
often easier to control both players, adding a computer player once you
have a basic game going. Once you have a stupid computer player, then
add more intelligence and heuristics (preferably into player subclasses).
If your program is structured well, you should be able to let the user
choose which opponent they want to play, and the different behaviors
are provided by setting which subtype of objects are used