com.bolinfest.prisonerbot
Interface PayoffMatrix

All Known Implementing Classes:
SimplePayoffMatrix

public interface PayoffMatrix

PayoffMatrix tells the payoff for each player for every permutation of player choices.

PayoffMatrix is immutable.

Author:
mbolin

Field Summary
static PayoffMatrix CANONICAL_PAYOFF_MATRIX
          The "canonical" payoff matrix where: Mutual cooperation yields 3 points for each player. Successful defection yields 5 points for the defector and 0 points for the cooperator. Mutual defection yields 1 point for each player.
 
Method Summary
 int[] calculatePayoff(Choice firstPlayerChoice, Choice secondPlayerChoice)
          Get the payoff for a given set of choices.
 int[] getAllPayoffs()
           
 String getDescription()
           
 String getName()
           
 

Field Detail

CANONICAL_PAYOFF_MATRIX

static final PayoffMatrix CANONICAL_PAYOFF_MATRIX
The "canonical" payoff matrix where:

Method Detail

getName

String getName()
Returns:
the name of the PayoffMatrix

getDescription

String getDescription()
Returns:
a description of the PayoffMatrix

calculatePayoff

int[] calculatePayoff(Choice firstPlayerChoice,
                      Choice secondPlayerChoice)
Get the payoff for a given set of choices.

Parameters:
firstPlayerChoice - the choice made by the first player
secondPlayerChoice - the choice made by the second player
Returns:
an int array of length 2 where the first element is the payoff for the first player and the second element is the payoff for the second player
Throws:
IllegalArgumentException - if either choice is null

getAllPayoffs

int[] getAllPayoffs()