• On the sides of the grid 'o's represent exit/entry ports of the game.
• A User token may start at any of the exit/entry ports and exit from any of the ports.
• If the ports of path cards(tiles) collide, they are assumed to be connected. For example, port 3 of the tile 1 (first row, first column) is connected to port 6 of the tile on the right.
Rules of The Game • For a general understanding of the game please read the necessary wikipedia articles. You can find more information on other webpages.
• Basically:
– It is a turn-based game.
– There are at least 2 players, each one has a token.
– Game starts randomly. (random entry ports are chosen for each player) – Initially, the 2D grid is empty.
– Each player is given a set of cards(Generally 3 cards.)
– A turn starts with the player deciding on a card(selecting a card from the set given). If the set of cards is empty, a new set is requested (how you generate a set is up to you. It has to be flexible for further modifications. So hide unnecessary details.)
– Once a card is selected, it is placed in an empty cell on the 2D grid.
– The token follows the route on the card placed.
– The objective is to remain on the game.
Example:
• Initial. Player1(token X) places a path card:
------X--o--------o--o--------o--o------
| ....1..2.... |
| : 8 6 : | o 8 1 5 3 o Y 7 4 7 4 o | : 2 3 : | | ....6..5... |
| | | | o o o o | | | | | | | | o o o o | | | |
------o--o--------o--o--------o--o------
• With the tile which is recently placed, the game advances. X follows the path and exist the game(loses). Y follows its path and waits for the next event.
• It’s Player2(token Y)’s turn:
------o--o--------o--o--------o--o------
| ....1..2.... |
| : 8 6 : | X 8 1 5 3 o o 7 4 7 Y o | : 2 3 : | | ....6..5... | | ....3..4.... |
| : 4 3 : | o 2 1 6 5 o o 1 2 5 6 o | : 7 8 : | | ....8..7.... |
| | | | o o o o | | | |
------o--o--------o--o--------o--o------
• At this stage there isn’t any other player, so Y wins.
Implementation • You have to use OOP principles.
• You cannot use the topics we haven’t covered in class. (you can utilize the tools you know from C programming course)
• For the solution, you may need to create several classes.
• Try to use the concepts such as encapsulation, protecting variables with const keyword, overloading functions/operators,
• Implement the whole game as a class and write necessary constructors for the cases such as player vs player, 3 players against each other etc...(for this you may need to have a player class as well.)
• This document does not fully describes the visualization of the game flow. Create necessary dialogs such as displaying set of cards to the user, asking user choice, presenting the state of the game, etc... It is your responsibility to create an appropriate flow so that the game can be played.
Remarks • Write comments in your code.
• If your code does not compile you will get 0
• Do not share your code with your classmates.
Turn in:
A complete C++ program <assignment_2_fullname_id.cpp which can be compiled using the following command: g++ -std=c++11 assignment_2_fullname_id.cpp -o assignment_2_fullname_id
If your program requires additional compile and link options, state those requirements at beginning of your source code as comment.