# Lluís Vila Grabulosa
# ETSEIB
# 13/Oct/2026.

def exp_score(ra, rb):
    '''
    INPUT:
    - ra, float, the player's elo rating.
    - rb, float, the oponent player's elo rating.
    OUTPUT:
    - The probablility or a win rounded to 2 decimals.
    REMARK: The 400 constant is a system convention.
    '''
    return round( 1 / (1+10**((rb-ra)/400)), 2)

def elo_update(elo, score, op_elo, k):
    '''
    It updates the current rating of a player with *score* against a player of op_rating.
    It computes 
    '''
    return round(elo + k*(score - exp_score(elo, op_elo)))
