import random import pandas as pd import itertools import numpy as np from sklearn.utils import shuffle num_rounds = 240 opponent = "triangle", "circle", "square" opponentb1 = list(opponent*(int((num_rounds/len(opponent))/2 ))) opponentb2 = list(opponent * (int((num_rounds / len(opponent)) / 2))) random.shuffle((opponentb1)) random.shuffle((opponentb2)) opponent_all = opponentb1+opponentb2 # these probabilities are directly from behavioral data of responders opponent_dict = dict(triangle = [0.0707, 0.1032, 0.1482, 0.2083, 0.2846, 0.3757, 0.4764, 0.5791, 0.6754, 0.7589, 0.8264, 0.8780, 0.9159, 0.9427, 0.9614, 0.9741, 0.9827, 0.9885, 0.9924, 0.9949, 0.9967], circle = [0.2844, 0.3839, 0.4942, 0.6051, 0.7061, 0.7902, 0.8552, 0.9026, 0.9356, 0.9579, 0.9728, 0.9825, 0.9887, 0.9928, 0.9954, 0.9971, 0.9981, 0.9988, 0.9992, 0.9995, 0.9997], square = [0.8268, 0.8855, 0.9261, 0.9530, 0.9705, 0.9816, 0.9885, 0.9929, 0.9956, 0.9973, 0.9983, 0.9990, 0.9994, 0.9996, 0.9998, 0.9998, 0.9999, 0.9999, 1.0000, 1.0000, 1.0000]) cir_c = 0 tri_c = 0 squ_c = 0 for ii in range(0, len(opponentb2)): if opponentb2[ii] == 'circle': cir_c = cir_c+1 cir_c = 0 tri_c = 0 squ_c = 0 for ii in range(0, len(opponent_all)): if opponent_all[ii] == 'circle': cir_c = cir_c+1 elif opponent_all[ii] == 'square': squ_c = squ_c+1 elif opponent_all[ii] == 'triangle': tri_c = tri_c+1