class Person
    
    attr_accessor :name, :success_points

    def initialize(name)
        @name = name
        @success_points = 0.0
    end

    def to_s
        puts @name
    end

    def expected_score(another_person)
        rB = another_person.success_points
        rA = @success_points
        x = (rB-rA)/400
        eA = 1/(1 + 10**x)
        return eA
    end

    def new_success_points(score, another_person)
        rA = @success_points
        eA = expected_score(another_person)
        sA = score
        result = rA + 32 * (sA - eA)
        return result
    end

    def self.update_success_points(winner, loser)
        points1 = winner.new_success_points(1, loser)
        points2 = loser.new_success_points(0, winner)

        winner.success_points += points1
        loser.success_points += points2
    end

end