Exemplo n.º 1
0
    def test_Decay(self):
        initial_rating = 800
        player1 = EloCompetitor(initial_rating=initial_rating)

        # if player1 beats someone with a high rating, their rating should go up.
        for _ in range(10):
            player2 = EloCompetitor(initial_rating=100)
            player2.beat(player1)
            self.assertLess(player1.rating, initial_rating)
            initial_rating = player1.rating
Exemplo n.º 2
0
    def test_Improvement(self):
        initial_rating = 100
        player1 = EloCompetitor(initial_rating=initial_rating)

        # if player1 beats someone with a high rating, their rating should go up.
        for _ in range(10):
            player2 = EloCompetitor(initial_rating=800)
            player1.beat(player2)
            self.assertGreater(player1.rating, initial_rating)
            initial_rating = player1.rating
Exemplo n.º 3
0
from elote import EloCompetitor

good = EloCompetitor()
better = EloCompetitor()
best = EloCompetitor()

print('Starting ratings:')
print('%7.2f, %7.2f, %7.2f' % (
    good.rating,
    better.rating,
    best.rating,
))

print('\nAfter matches')

for _ in range(10):
    better.beat(good)
    best.beat(better)
    print('%7.2f, %7.2f, %7.2f' % (
        good.rating,
        better.rating,
        best.rating,
    ))
Exemplo n.º 4
0
from elote import EloCompetitor

good = EloCompetitor(initial_rating=400)
better = EloCompetitor(initial_rating=500)

print('probability of better beating good: %5.2f%%' % (better.expected_score(good) * 100, ))
print('probability of good beating better: %5.2f%%' % (good.expected_score(better) * 100, ))

good.beat(better)

print('probability of better beating good: %5.2f%%' % (better.expected_score(good) * 100, ))
print('probability of good beating better: %5.2f%%' % (good.expected_score(better) * 100, ))
Exemplo n.º 5
0
from elote import EloCompetitor

good = EloCompetitor(initial_rating=500)
better = EloCompetitor(initial_rating=450)
best = EloCompetitor(initial_rating=400)
also_best = EloCompetitor(initial_rating=400)

print('Starting ratings:')
print('%7.2f, %7.2f, %7.2f, %7.2f' % (
    good.rating,
    better.rating,
    best.rating,
    also_best.rating,
))

print('\nAfter matches')

for _ in range(20):
    better.beat(good)
    better.lost_to(best)
    best.tied(also_best)
    print('%7.2f, %7.2f, %7.2f, %7.2f' % (
        good.rating,
        better.rating,
        best.rating,
        also_best.rating,
    ))