Player: Player Class

Usage Format Value Fields Methods Author(s) Examples

Usage

1

Format

R6Class object.

Value

R6Class object with methods for a player in an Axelrod-like tournament.

Fields

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:

opponent

A character string giving the name of the opponent.

memory

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:

round

Numerical value indicating the round of the tournament at which the data was collected.

play

A character string indicating the play ("C" for cooperate or "D" for defect) played by the player at each round.

opponent

A character string indicating the name of the opponent at each round.

opponent_play

A character string indicating the play ("C" for cooperate or "D" for defect) played by the opponent at each round.

score

A numerical value indicating the payoff received by the player at each round.

Methods

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:

opponent

A character string giving the name of the opponent.

memory

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.

opponent

A character string indicating the name of the opponent.

update(play, opponent, opponent_play, score)

Update the player's memory.

play

The play of the player in the current round ("C" for cooperate; "D" for defect).

opponent

A character string indicating the name of the opponent.

opponent_play

The play of the opponent in the current round ("C" for cooperate; "D" for defect).

score

A numerical value indicating the payoff received at the current round.

opponent_score

A numerical value indicating the payoff received by the opponent at the current round.

reset()

Reset the player's memory.

Author(s)

Simon Garnier, garnier@njit.edu

Examples

1
# TODO

swarm-lab/axelRod documentation built on May 30, 2019, 9:34 p.m.