// Prisoner.java: interface for Iterated Prisoner's Dilemma task // COS 445, Spring 2017 // correction 3/24/17: swap (1,1) and (2,2) in payoff matrix public interface Prisoner { // return true to cooperate, false to defect public boolean cooperate(); // callback to receive action public void receive(boolean action); // play head-to-head: return {p1's payoff, p2's payoff} // this is for your convenience (notice that it's static) public static int[] test(Prisoner p1, Prisoner p2) { final int N_ROUNDS = 1000; final int[][][] PAYOFFS = {{{1,1},{5,0}},{{0,5},{2,2}}}; int[] totals = {0, 0}; for (int i=0; i