Adaptation (cont)
From Player.m: -adaptType:
while ((neigh = [index next])) {
currentPayoff = [neigh getAveragePayoff];
if ((currentPayoff > bestPayoff)) {
bestPayoff = currentPayoff;
bestType = [neigh getPlayerType];
} else if (currentPayoff == bestPayoff) {
From Player.m: -updateType
[self setPlayerType: newType]
Player looks around neighborhood and picks neighbor type with highest payoff
Put type value into temporary variable
Finally set type to value of temporary variable