Example #1
0
        public void FakeGame(Game game)
        {
            PlayerDay d;
            int       insertAfterDay = FindDayBefore(game.day);

            if (days.Count == 0 || days[insertAfterDay].day != game.day)
            {
                PlayerDay new_pday = new PlayerDay(this, game.day);
                if (days.Count == 0)
                {
                    new_pday.isFirstDay = true;
                    new_pday.SetGamma(1);
                }
                else
                {
                    new_pday.SetGamma(days[insertAfterDay].GetGamma());
                }
                d = (new_pday);
            }
            else
            {
                d = days[insertAfterDay];
            }
            if (game.playerFinder.ContainsKey(this))
            {
                game.loserDays[this] = d;
            }
            else
            {
                game.winnerDays[this] = d;
            }
        }
Example #2
0
        public void AddGame(Game game)
        {
            if (days.Count == 0 || days[days.Count - 1].day != game.day)
            {
                PlayerDay newPDay = new PlayerDay(this, game.day);
                if (days.Count == 0)
                {
                    newPDay.isFirstDay = true;
                    newPDay.totalGames = 2;
                    newPDay.SetGamma(1);
                    newPDay.naturalRatingVariance = 10;
                }
                else
                {
                    newPDay.totalWeight = days[days.Count - 1].totalWeight;
                    newPDay.totalGames  = days[days.Count - 1].totalGames;
                    newPDay.SetGamma(days[days.Count - 1].GetGamma());
                    newPDay.naturalRatingVariance = days[days.Count - 1].naturalRatingVariance + (float)Math.Sqrt(game.day - days[days.Count - 1].day) * GlobalConst.NaturalRatingVariancePerDay(days[days.Count - 1].totalWeight);
                }
                days.Add(newPDay);
            }
            if (game.playerFinder.ContainsKey(this))
            {
                game.loserDays[this] = days[days.Count - 1];
            }
            else
            {
                game.winnerDays[this] = days[days.Count - 1];
            }

            days[days.Count - 1].AddGame(game);
        }