Skip to content

Instantly share code, notes, and snippets.

View eIGato's full-sized avatar

Evgeny Denisov eIGato

  • Saint-Petersburg, Russia
View GitHub Profile
@eIGato
eIGato / hearthstone.py
Created February 20, 2022 13:34
Calculate star gaining rate based on the deck win rate
# WR 45.34% is enough to keep your ground.
# WR 50% gains 0.125 stars per battle on average.
def get_streak_points(num_wins):
if num_wins < 3:
return num_wins
return num_wins * 2 - 2
from django.db import models
class AnnotateByMixin():
"""Mixin that allows adding predefined annotations to queryset.
Example:
class DialogQuerySet(AnnotateByMixin, models.QuerySet):
predefined_annotations = {