Search
Here, you will find a detailed description of the required player's functionalities.
All the player's code needs to be placed in the player.py file. You will upload this (and only this) file to BRUTE. The player can import the standard python modules, e.g., random, math.
player.py
It is important to note that the opposing players do not communicate directly. Their communication is arranged via a moderator/broker which asks the players for their response and archives the results of the match. Implement your player (file player.py) in a form of a class called MyPlayer. The class must implement the following methods:
MyPlayer
__init__
payoff_matrix
number_of_iterations
move
record_last_moves
(my_last_move, opponent_last_move)
The class - the player - should be identified by a short description in the form of the docstring. The description should explain the player's strategy. Example:
class MyPlayer: '''The player is very moody but mostly chooses COOPERATE.''' def __init__ # standard code follows
Player's A reward in case they play COOPERATE and the player B play DEFECT is coded as:
payoff_matrix[0][1][0]
Note: You can assume that the payoff matrix will always be symmetrical. The player, therefore, does not have to know if it is a player A or B. They share exactly the same opportunities and risks.
Python representation of the same payoff matrix:
payoff_matrix = ( ((4,4),(1,6)) , ((6,1),(2,2)) )
Simply put, the player's job is to play.
After implementing your player class, we recommend downloading the following code:
game.py
test_game.py
Read through these Python files and try to run them with your player (test_game.py puts two identical players against each other). You can modify the files at your will, of course.