Beispiel #1
0
        public counter_pick_logic()
        {
            counterpick_info cp_info = new counterpick_info();

            matrix_info = cp_info.getCounterTable();
            heroGenerateTypes hGT = new heroGenerateTypes();

            HT_table = hGT.getTypeTable();
        }
Beispiel #2
0
        public counter_pick_logic(string dataFolderLocation)
        {
            this.dataFolderLocation = dataFolderLocation;

            counterpick_info cp_info = new counterpick_info();

            matrix_info = cp_info.getCounterTable();
            this.readTeam();
            heroGenerateTypes hGT = new heroGenerateTypes();

            HT_table = hGT.getTypeTable();
        }
Beispiel #3
0
        /*
         * version_1.1.0 logic_counter
         * Input: the hero_sequence which is heros picked by enemy team
         *        the ban_list contains the heros picked by own team and all baned heros by both team.
         * output: the best five hero we suggest to pick
         * improve place: consider the role of the heros in the own team, consider the difficulty of the heros.
         */
        public static int[] logic_counter_1(int[] hero_sequence_enemy, int[] hero_sequence_teammate, int[] ban_list, int diff_level)
        {
            Dictionary <double, int> five_picks  = new Dictionary <double, int>();
            Dictionary <double, int> proper_pick = new Dictionary <double, int>();
            hero_difficulty          h_diff      = new hero_difficulty();
            heroGenerateTypes        h_type      = new heroGenerateTypes();

            int[,] h_type_table = h_type.getTypeTable();
            // At least a team needs at least two Disabler[1],
            // better have one middle laner[10] and one offlaner[9],
            // at least two support[4] and at least two carry[0],
            // no more than 4 support or no more 4 carry.
            // 0:[Carry], 1: [Disabler] 2: [Initiator], 3:[Jungler], 4:[Support], 5:[Durable]
            // 6:[Nuker], 7: [Pusher], 8: [Escape], 9: [Offlane] 10: [Midlane]
            int[] roleList = new int[5];
            for (int i = 0; i < hero_sequence_teammate.Length; i++)
            {
                if (h_type_table[hero_sequence_teammate[i], 0] == 1)
                {
                    roleList[0]++;
                }
                if (h_type_table[hero_sequence_teammate[i], 1] == 1)
                {
                    roleList[1]++;
                }
                if (h_type_table[hero_sequence_teammate[i], 4] == 1)
                {
                    roleList[2]++;
                }
                if (h_type_table[hero_sequence_teammate[i], 9] == 1)
                {
                    roleList[3]++;
                }
                if (h_type_table[hero_sequence_teammate[i], 10] == 1)
                {
                    roleList[4]++;
                }
            }

            proper_pick.Add(1, 91);
            proper_pick.Add(1.4, 46);
            proper_pick.Add(1.6, 87);
            proper_pick.Add(1.8, 105);
            proper_pick.Add(2, 13);
            proper_pick.Add(1.7, 15);
            proper_pick.Add(1.2, 20);
            int[]  five_hero_array = new int[5];
            int    length          = hero_sequence_enemy.Length;
            int    count           = 1;
            int    flag            = 0;
            double lowest_fact     = 100;

            double[] counterFact = new double[5];
            if (hero_sequence_enemy.Sum() == 0)
            {
                foreach (KeyValuePair <double, int> pair in proper_pick)
                {
                    if (!ban_list.Contains(pair.Value))
                    {
                        five_picks.Add(pair.Key, pair.Value);
                    }
                    if (five_picks.Count == 5)
                    {
                        break;
                    }
                }
            }
            else
            {
                while (count <= 115)
                {
                    if (hero_sequence_enemy.Contains(count) || ban_list.Contains(count) || hero_sequence_teammate.Contains(count))
                    {
                        count++;
                        continue;
                    }
                    double sum1 = 0;
                    for (int i = 0; i < length; i++)
                    {
                        sum1 = sum1 + matrix_info[hero_sequence_enemy[i], count] + 0.2 * role_factor(roleList, count) + 0.2 * (3 - diff_level) * (14 - h_diff.getFinalRating(count));
                    }
                    if (flag < 5)
                    {
                        if (five_picks.ContainsKey(sum1))
                        {
                            sum1 = sum1 + 0.001;
                        }
                        five_picks.Add(sum1, count);

                        if (sum1 < lowest_fact)
                        {
                            lowest_fact = sum1;
                        }
                        flag++;
                    }
                    else if (flag >= 5)
                    {
                        if (sum1 > lowest_fact)
                        {
                            int removeKey = five_picks[lowest_fact];
                            five_picks.Remove(lowest_fact);

                            if (five_picks.ContainsKey(sum1))
                            {
                                sum1 = sum1 + 0.001;
                            }
                            five_picks.Add(sum1, count);
                            lowest_fact = five_picks.Min(i => i.Key);
                        }
                    }
                    count++;
                }
            }

            var list = five_picks.Keys.ToList();

            list.Sort();

            // Loop through keys.
            int index = 4;

            foreach (var key in list)
            {
                five_hero_array[index] = five_picks[key];
                index--;
            }

            return(five_hero_array);
        }