Beispiel #1
0
 private static void InitHandTypes(Statistic.HandStatistic[] handStatistics)
 {
     for (int hand_value = 0; hand_value < handStatistics.Length; hand_value++)
     {
         HandType hand_type;
         if (!HandTypeConverter.TryGetHandType(hand_value, out hand_type))
         {
             handStatistics[hand_value].HandType = (HandType)int.MinValue;
             continue;
         }
         else
         {
             handStatistics[hand_value].HandType = hand_type;
         }
     }
 }
Beispiel #2
0
        private Statistic PreparePublicStatistic(StatisticInternal stat)
        {
            var public_stat = new Statistic();
            public_stat.GameNumber = SimulatedGamesCount;

            var player_hands_stat = new List<Statistic.HandStatistic>();

            for (int hand_value = 0; hand_value < stat.PlayerHandsStat.Length; hand_value++)
            {
                HandType player_hand_type;
                if (!HandTypeConverter.TryGetHandType(hand_value, out player_hand_type))
                {
                    continue;
                }

                player_hands_stat.Add(stat.PlayerHandsStat[hand_value]);
            }
            public_stat.PlayerHandsStat = player_hands_stat.ToArray();

            public_stat.Win = public_stat.PlayerHandsStat.Sum(x => x.Win);
            public_stat.Draw = public_stat.PlayerHandsStat.Sum(x => x.Draw);
            public_stat.Lose = public_stat.PlayerHandsStat.Sum(x => x.Lose);

            var enemy_hands_stat = new List<Statistic.HandStatistic>();
            for (int hand_value = 0; hand_value < stat.EnemyHandsStat.Length; hand_value++)
            {
                HandType enemy_hand_type;
                if (!HandTypeConverter.TryGetHandType(hand_value, out enemy_hand_type))
                {
                    continue;
                }

                enemy_hands_stat.Add(stat.EnemyHandsStat[hand_value]);
            }
            public_stat.EnemyHandsStat = enemy_hands_stat.ToArray();

            return public_stat;
        }