def play_game(): print "calling play_game" games_played = [] global grid, next_grid, games_played for x in range(space_size): for y in range(space_size): current_fox = grid[x][y] if type(current_fox) != Fox: continue for foxB in current_fox.fox_neighbors: if (current_fox.stag_neighbors == 0 and current_fox.rabbit_neighbors) > 0: g.inclusive_cooperate = 0 g.inclusive_defect = 3 g.exclusive_defect = 3 g.exclusive_cooperate = 0 if len(current_fox.fox_neighbors) > 0: if current_fox.stag_neighbors == 0 and current_fox.rabbit_neighbors == 0: continue if (current_fox, foxB ) not in games_played and current_fox is not foxB: g = Nash.Game(current_fox, foxB) if current_fox.stag_neighbors > 0 and current_fox.rabbit_neighbors > 1: g.inclusive_cooperate = 5 g.inclusive_defect = 3 g.exclusive_defect = 0 g.exclusive_cooperate = 3 elif current_fox.stag_neighbors > 0 and current_fox.rabbit_neighbors == 0: g.inclusive_cooperate = 5 g.inclusive_defect = 0 g.exclusive_defect = 0 g.exclusive_cooperate = 0 elif current_fox.stag_neighbors == 0 and current_fox.rabbit_neighbors > 1: g.inclusive_cooperate = 0 g.inclusive_defect = 3 g.exclusive_defect = 0 g.exclusive_cooperate = 3 current_fox.last_score = current_fox.score foxB.last_score = foxB.score g.play() games_played.append((current_fox, foxB)) games_played.append((foxB, current_fox))