<jupyter_start><jupyter_text>Blackboard for objects<jupyter_code>import nbimporter
from teams import Team, Match
from players import Player
from utils import FIFA
from collections import defaultdict
import numpy as np
football = '../data/fifa/fifa_2018.csv'
data = FIFA.load(football)
H = Team('Juventus', data)
A = Team('Roma', data)
H.selection(module={Player.DEF: 4, Player.MID: 3, Player.ATT: 3})
A.selection(module={Player.DEF: 4, Player.MID: 3, Player.ATT: 3})
match = Match(H, A, duration=90)
match.kickoff(verbose=True, sleep=0)
print (match.score)
print (["{} ({}')".format(p.name, m) for m, p in match.scorers])<jupyter_output><empty_output><jupyter_text>Stats<jupyter_code>H = Team('Juventus', data)
A = Team('FC Barcelona', data)
H.selection(module={Player.DEF: 4, Player.MID: 3, Player.ATT: 3})
A.selection(module={Player.DEF: 4, Player.MID: 3, Player.ATT: 3})

winners = {H.name: 0, A.name: 0, 'X': 0}
scorers = defaultdict(lambda: 0)
for m in range(100):
    match = Match(H, A, duration=90)
    match.kickoff(verbose=False, sleep=0)
    if match.score[H.name] > match.score[A.name]:
        winners[H.name] += 1
    elif match.score[A.name] > match.score[H.name]:
        winners[A.name] += 1
    else:
        winners['X'] += 1
    for m, p in match.scorers:
        scorers[p.name] += 1
print (winners)
for k, v in sorted(scorers.items(), key=lambda x: -x[1]):
    print (k, v)<jupyter_output><empty_output><jupyter_text>Visualization<jupyter_code>football = '../data/fifa/fifa_2018.csv'
data = FIFA.load(football)
H = Team('Juventus', data)
A = Team('Napoli', data)
H.selection(module={Player.DEF: 4, Player.MID: 4, Player.ATT: 2})
A.selection(module={Player.DEF: 4, Player.MID: 3, Player.ATT: 3})
match = Match(H, A, duration=90)
match.kickoff(show=True, sleep=1, verbose=True)
print (match.score)
print (match.scorers)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17228464419475656, 'fraction_numerical': 0.02514713750668807, 'mean_word_length': 4.993589743589744, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '638686', 'license': 'MIT', 'n_tokens_mistral': 763, 'n_tokens_neox': 709, 'n_words': 166, 'path': 'game/main.ipynb', 'repo_name': 'afflint/pygen', 'size': '1869'}