예제 #1
0
        public void fakeGame(Game game)
        {
            PlayerDay d;

            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.setGamma(1);
                    newPDay.uncertainty = 10;
                }
                else
                {
                    newPDay.setGamma(days[days.Count - 1].getGamma());
                    newPDay.uncertainty = days[days.Count - 1].uncertainty + (float)Math.Sqrt(game.day - days[days.Count - 1].day) * w2;
                }
                d = (newPDay);
            }
            else
            {
                d = days[days.Count - 1];
            }
            if (game.whitePlayers.Contains(this))
            {
                game.whiteDays.Add(this, d);
            }
            else
            {
                game.blackDays.Add(this, d);
            }
        }
예제 #2
0
        public void AddGame(Game game)
        {
            int insertAfterDay = days.Count == 0 ? -1 : ((days[days.Count - 1].day <= game.day) ? (days.Count - 1) : FindDayBefore(game.day));

            if (days.Count == 0 || days[insertAfterDay].day != game.day)
            {
                PlayerDay newPDay = new PlayerDay(this, game.day);
                if (days.Count == 0)
                {
                    newPDay.isFirstDay = true;
                    newPDay.setGamma(1);
                    newPDay.uncertainty = 10;
                }
                else
                {
                    newPDay.setGamma(days[insertAfterDay].getGamma());
                    newPDay.uncertainty = days[insertAfterDay].uncertainty + (float)Math.Sqrt(game.day - days[insertAfterDay].day) * w2;
                }
                days.Insert(insertAfterDay + 1, newPDay);
                insertAfterDay++;
            }
            if (game.whitePlayers.Contains(this))
            {
                game.whiteDays.Add(this, days[insertAfterDay]);
            }
            else
            {
                game.blackDays.Add(this, days[insertAfterDay]);
            }

            days[insertAfterDay].AddGame(game);
        }
예제 #3
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);
        }
예제 #4
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;
            }
        }
예제 #5
0
        private float GetLoserNaturalRating(int team)
        {
            float ret = 0;
            float w;

            foreach (Player p in loserPlayers[team])
            {
                PlayerDay pd = loserDays[p];
                w    = GetPlayerWeight(pd.player);
                ret += pd.GetNaturalRating() * w;
            }
            return(ret);
        }