Vous êtes sur la page 1sur 2

Assignment 2: Implementing a Multi‐player Game.

   
Deadline: November 2 (Monday), 2009, midnight 
This will be a web‐based application. There is no specific technology required; you can use 
whatever language / environment you feel comfortable with. You need to store the results of 
each player’s actions at each round – you can use a database, file, or Google  spreadsheet. If 
you want to use a database, there is a PostGres server available for students at the department, 
which you can use. 
Part 1. (worth 70%) In this assignment, you have to implement a simple multi‐player game. This 
game requires a group of players N (N ≥ 2) to play synchronously. Each player is given the same 
amount of money (let’s say $20) at the start of the game, which is stored in the individual 
player’s account Y. The game can be played repeatedly, in many rounds. At each round, the 
players take turns “investing” their money into a group account. In the end of the round, they 
collect “interest“ from the group account. Each player decides how much to invest – either 
nothing at all, or some amount, smaller than the amount he/she currently has in his/her 
individual account.  
The interface should alert players about the new round, invite them to enter the amount of 
their investment X (X<= Y), and check that it is a valid number (0<=X<=Y). It should not display 
the amount invested by the other players during the round. When all players have made their 
contributions to the group account (the round is complete), the amount of money in the group 
account is automatically multiplied by a factor M (1<M< N) and divided equally among the 
players and added to their accounts. As a result, the group account is back at 0. The players see 
the result of each round of the game immediately reported as a table showing how much each 
players had originally in his/her account, how much he/she has invested in this round and the 
updated amount of money in their account.  
For example, if we have 5 players, each of them initially with $20, and in the first round three of 
them choose to invest $5, one invests $10, and one doesn’t invest at all, the group account at 
the end of the round will have $25. If you have sent M=3 for your game, the amount 25*3 will 
be distributed among the 5 players, so each one will gain 15. The payers will see as result of this 
round a table like this:  
Player name  Account before   Amount invested  Account after 
 
Player 1  20  5  30 
Player 2  20  5  30 
Player 3  20  0  35 
Player 4  20  5  30 
Player 5 (you)  20  10  25 
After that, they play the next round of the game with the amounts in their account. The game 
ends after one player is broke or after a certain number of rounds (e.g. 10), whichever occurs 
first. The winner is the player with the highest amount in his/her account.  
Your game should keep a database (file or table) with these values for each round and each 
player.  
Evaluation and Deliverable: Experiment with the game by playing with your friends (try to get 
at least 5 people) for at least 10 periods. Collect the statistics from each period (you can do this 
“post mortem” using the collected data, for example, using Excel), and create a graph of the 
amounts invested in each round by each player to see the trend in their investment. The graph 
should have horizontal axis – the number of the round, and vertical axis – the amount invested. 
Also for each round, compute what percentage of the players who cooperated (# of people who 
invested a non‐zero amount in the group account/#total of players) and make a graph with the 
trend in cooperation between players (with axes: horizontal (x) Æ round and vertical (y) 
Æcooperation rate (%)). Discuss the results – do you observe any trends? If yes, try to explain 
them.  
 
Part 2. (worth 30%) Now you have to modify the game to allow players to “punish” each other 
for non‐cooperative behaviour.  At the end of each round, after revealing the contributions of 
the other players, each player has the option to punish one or more of the other players. The 
best way to incorporate this in the interface is to have two buttons below the table with the 
round results: “Punish” or “Continue”. If the player chooses to “punish”, they will be given a 
choice of players to punish. The player can now assign a number of “punishment points” to any 
of the other players. Each punishment point costs the punisher a little money, but the penalized 
player gets “fined” substantially. For example, each punishment point reduces the punisher’s 
account by 1 money unit and the punished subject’s account by 10%. After assigning the 
“punishment points”, the player clicks on “continue” to continue to the next round. When all 
players have clicked on “continue”, a summary of punishments made, if any, is shown.  
The modified game should keep track also of the punishments that were applied by the players 
in each round, in addition to all the data in part 1.  
Evaluation and Deliverable: Experiment with the modified game with a group of friends for at 
least 10 rounds. Compute and make a chart with the same data as in part 1. Do you see any 
trend in the individual’s investments or in the group’s cooperation rate? Is it similar or different 
from the one observed in Part 1? If different, discuss why.  
 
Submission of assignment: Send an email to Yuan (yuanwang_0811@hotmail.com) before the 
deadline, with a simple “read‐me”  file with instructions of how to access and run the game and 
a link to your deliverable(s), or just attach them to your e‐mail. If you cannot find 24*7 server to 
host your application, you can make an appointment with Yuan and present your running 
application to him.  

Vous aimerez peut-être aussi