def VALUE_AT_PLY(val, ply):
    """ Return the value of scoring val a given number of plies into the future. """
    if val >= +32512:
        return val - ply
    if val <= -32512:
        return val + ply
    return val