Usage Format Value Fields Methods Author(s) Examples
1 |
R6Class
object.
R6Class
object with methods for a player in an
Axelrod-like tournament.
name
A character string giving the name of the player.
strat
A function implementing the strategy of the player. This function must take 2 arguments:
A character string giving the name of the opponent.
A data frame with 5 columns named "round", "play", "opponent",
"opponent_play", and "score" (see memory
field below).
memory
A 5-column data frame, with the following columns:
Numerical value indicating the round of the tournament at which the data was collected.
A character string indicating the play ("C" for cooperate or "D" for defect) played by the player at each round.
A character string indicating the name of the opponent at each round.
A character string indicating the play ("C" for cooperate or "D" for defect) played by the opponent at each round.
A numerical value indicating the payoff received by the player at each round.
new(type, players, nreps, nrounds, payoff)
Create an object
of clase Tournament
.
name
A character string indicating the name of the player. If not provided, a random name is generated by the function.
strat
A function implementing the strategy of the player. This function must take 2 arguments:
A character string giving the name of the opponent.
A data frame with 5 columns named "round", "play",
"opponent", "opponent_play", and "score" (see memory
field
above).
mem_size
A numerical value indicating the size of the player's memory (default: 100).
play(opponent)
Play a tournament round.
A character string indicating the name of the opponent.
update(play, opponent, opponent_play, score)
Update the player's memory.
The play of the player in the current round ("C" for cooperate; "D" for defect).
A character string indicating the name of the opponent.
The play of the opponent in the current round ("C" for cooperate; "D" for defect).
A numerical value indicating the payoff received at the current round.
A numerical value indicating the payoff received by the opponent at the current round.
reset()
Reset the player's memory.
Simon Garnier, garnier@njit.edu
1 | # TODO
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.