text_plain_output_2.png text_plain_output_1.png
from kaggle_environments import make

from kaggle_environments.envs.rps.agents import agents

from tqdm.auto import tqdm

import numpy as np

import pandas as pd

from kaggle_environments import make
from kaggle_environments.envs.rps.agents import agents
import numpy as np
import pandas as pd
from tqdm.auto import tqdm
all_agents = ['submission.py', 'submission1.py', 'submission2.py', 'submission3.py', 'nash.py', 'nash2.py', 'nash3.py'] + list(agents.values())
all_agent_names = ['submit', 'submit1', 'submit2', 'submit3', 'nash', 'nash2', 'nash3'] + list((k[:8] for k in agents.keys()))
env = make('rps', configuration={'episodeSteps': 1000}, debug=True)
L = len(all_agents)
results = np.zeros((L, L), dtype=int)
N = 100
for it in tqdm(range(N), total=N):
    for a1 in range(L):
        a2 = 0
        env.run([all_agents[a1], all_agents[a2]])
        rewards = env.toJSON()['rewards']
        results[a1, a2] += -1 if rewards[0] is None else int(rewards[0] > 0) - int(rewards[0] < 0)
        results[a2, a1] += -1 if rewards[1] is None else int(rewards[1] > 0) - int(rewards[1] < 0)
print(pd.DataFrame(results, columns=all_agent_names, index=all_agent_names))