Project Mountain goats game
Andreas Artemiou
Due date: 7th of May 2021 by 23:59 in Learning Central
1 General purpose of the exercise
The objectives in this project is to write a player function for the game that will participate on the tournament following the guidelines below (each one of you need to write this individually)
The simulator of the game will be presented to you in class, explaining all the steps I had to thing before writing the simulator.
2 General description of the game
Mountain goats ia a board game that is played between 2 and 5 players. Each player has 6 goats and it puts one in front of each mountain (therefore there are 6 mountains). The objective is to take your goat at the top of the mountain and then you can get points.
To understand the game better let’s see the outline of the game:
1. the six mountains are labeled as 5, 6, 7, 8, 9 and 10. Mountains 5 and 6 have height 4 steps, mountains 7 and 8 have height 3 steps and mountains 9 and 10 have height 2 steps.
2. Each player puts a goat is put at the bottom of each mountain (outside the first step)
3. Each player rolls 4 dice. Then it combines dice together to decide which goats to move. For example if they roll 2, 3, 5, 5, the player can put together the 2 and 3 and individually each of the 5s and therefore they can move the goat in front of mountain 5 a total of 3 steps up. Alternatively, they can put 2 and 3 together to get a 5 and 5 and 5
1
together to get a 10, and therefore they can move the goat in front of mountain 5 one step and the goat in front of mountain 10 another step. Goats from different players can share the same step on a mountain, except the top one (see below at number 5 what happens in this case)
4. If someone rolls two or more 1, for example 1, 1, 5, 6, or 1, 1, 1, 3 then they can change all but one of the 1s to any number they like. So in the first case they can change one of the 1s, in the second case they can change up to two of the 1s.
5. If a goat reach the top of the mountain it receives a token and it stays at the top. Every time the player rolls that number they receive a token. If the goat of another player reaches the top then they can kick the player that was already at the top of the mountain down.
6. Each mountain has a different number of tokes. Mountain 5 has 12 tokens, mountain 6 has 11, mountain 7 has 10, mountain 8 has 9, mountain 9 has 8 and mountain 10 has 7 tokens.
7. There are also 4 special tokens. The first four players to complete a set of tokens (one 5, one 6, one 7, one 8, one 9 and one 10) they receive one extra token. The first one gets 15 points, the second 12 points, the third 9 points and the fourth 6 points.
8. The game ends either when three mountains have 0 tokens left or when all 4 special tokens are gone. The round needs to be completed though, so that all players have the same number of turns.
I have written a simulator of the game which takes the following inputs in order:
• np: the number of players playing the game
• playfun: the name of the player functions competing
3 Player function
You are expected to write a function that simulates a player that has smarter strategy than your fellow classmates. This is individual work and each one of you needs to submit their own player function. It is helpful if you name it “playerlastname”, i.e. I will name mine “playerArtemiou”.
2
3.1 What the function needs
The function that simulates the player will pass the following information to your player function:
• cp: the current player order (whether you are player 1, 2, 3 or 4)
• dice: a vector of 4 numbers which indicates the outcome of the roll of
the dice.
• Gs: which is an np times 6 matrix that is considered the status of the game. Each row is dedicated to one player. Player 1 is represented in row 1 and Player 4 in row 4. Then each column is representing a mountain. The first column has information for mountain 5, the sec- ond for mountain 6 and so on so that the last column has information for mountain 10. The matrix is populated with numbers that indicates which step is occupied by each player’s goat for each mountain. For example if the entry in the matrix “Gs[2, 3] = 1” it means that player 2 on mountain 7 has the goat at the first step.
• TL: which is a vector of length 7. The first entry tells us how many tokens are left in mountain 5, the second the number of tokens left in mountain 6 and so on until the sixth entry that has the number of tokens left in mountain 10 and the last entry has the number of Bonus tokens left.
The player function, needs to return just one vector that has the combination of the dice that indicates the mountains the player will move the goats. So if the outcome of the dice is 1, 3, 4, 6 and the player decides to attack 1+4 = 5 and 3+6 = 9 the player function needs to return a vector with two numbers 5,9. If the player decides to merge 4 and 6 to get a 10 and leave 1 and 3 together that makes 4 (a useless outcome in the game) either return a vector with only one entry 10 or two entries 4, 10.
3.2 Some guidelines
For a player function to be able to participate in the tournament:
• It needs to work flawlessly. Every little detail counts to make sure that it communicates with the simulator, otherwise the simulator will give an error in which case we will not be able to have the function in the tournament. (Have in mind that each function will be tested
3
individually on a number of test case scenarios to make sure that it works flawlessly)
• Even if the simulator does not give error messages there are logical things that needs to be checked. For example, you may make your player function to be changing the game status matrix, which is not an error in programming, and therefore R will not produce an error, but it is not something that will happen logically. Or if the vector does not match the die that comes in. For example you get the roll of the dice outcome to be 1, 2, 2, 2 and the function returns number 10 (which is impossible based on this roll).
• It needs to follow the guidelines given in this document.
• It shouldn’t be cheating.
• You are allowed to use different techniques but NOT global variables in your player function.
VERY IMPORTANT!!!! You are not allowed to make any changes to the simulator. The only thing you are allowed to do is to write a player function which is compatible with the simulator. Your player function is only for decision making, which mountain goats to be moved. All the updates to the game (Goats matrix, tokens taken, whether the game is ending or anything else are done by the simulator. You shouldn’t be worrying about that.
3.3 Deliverables
The code of the player function with .txt or .R and a 2-page summary of what your player function is doing. If it works perfectly describe all the things you did to make it a smart player function. If there are things that do now work well, give me an indication of what is not working and why you didn’t fix it.
3.4 Marking Scheme
This is on how you will be marked:
• Writing a player function (50 points)
• Using correct programming principles in your code (10 points)
4
• Creativity and originality in your code as well as the presentation of the materials. (20 points)
• The last 20 points will be shared by those who win the tournaments at the end (probably proportionally)
Partial credit will be given for partially good performance. Late assign- ments receive a 0.
Also remember that I prefer to have a player function that runs flawlessly and it is less smart than a player function that tries to be very smart but doesn’t work and it will not be able to run in the tournament.
3.5 Individual work
This is an individual assignment. I am happy for you to discuss ideas with others in an effort to make sure that you are taking into account and thinking about all the parameters that may affect a player’s decision. (You may even try to put your functions in the simulator with 2-3 other people and see what you get. If you are losing all the time maybe you need to think a bit harder and make your function a bit smarter). Whatever you do though, each one of you needs to submit, individually, a piece of work that is their own and not someone’s else code. Don’t forget that to win tournaments you have to think a bit outside the box and a bit on a different direction than others are thinking.
5