Skip to content

Instantly share code, notes, and snippets.

View mrtolkien's full-sized avatar
🏠
Working from home

Tolki mrtolkien

🏠
Working from home
View GitHub Profile
@mrtolkien
mrtolkien / connector.py
Created April 29, 2021 02:14
LCU driver usage example
from lcu_driver import MultipleClientConnector
@connector.ws.register("/lol-champ-select/v1/session")
async def champ_select_listener(connection, event):
# Happens sometimes, need to properly analyze it
if not event.data:
return
# This is simply an ongoing draft, we exit after having written the draft
if event.data["timer"].get("phase") not in ["", "FINALIZATION", "GAME_STARTING"]:
@mrtolkien
mrtolkien / inhouse_rank.py
Created December 9, 2020 05:44
Inhouse rank exploration
import itertools
import math
import tabulate
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
from collections import defaultdict
import trueskill
import splyce_lol_data_commons as sp
from collections import defaultdict, Counter
import datetime
blind_picks = defaultdict(lambda: Counter()) # Very convenient data structure for counting
session = sp.get_read_session() # SQLAlchemy session
team_name = 'SK Telecom T1'
start_date = datetime.date.fromisoformat('2019-06-01'))
# First, we get all the games objects as well as the chosen team's id in those games