public Dictionary <String, HoningNode <String> > GetCardsBySingleBound(ref HoningNetwork <String> net, String target, String filter = null)
        {
            Dictionary <String, HoningNode <String> > recruit = new Dictionary <string, HoningNode <string> >();
            List <String> targets = new List <string>();

            targets.Add(target);
            net.recruitNeurds(targets, out recruit, filter);
            return(recruit);
        }
        public List <String> GetCardsByBound(ref HoningNetwork <String> net, List <String> targets)
        {
            Dictionary <String, HoningNode <String> > recruit = new Dictionary <string, HoningNode <string> >();

            net.recruitNeurds(targets, out recruit);
            List <String> ret = new List <string>();

            foreach (String k in recruit.Keys)
            {
                ret.Add(recruit[k].holder);
            }
            return(ret);
        }
Пример #3
0
        public void seek_by_card(HoningNetwork <String> net, String card_name, int return_count, float threshold, out List <String> result)
        {
            // Retorno padr'ao
            result = null;

            if (return_count <= 0)
            {
                return;
            }

            // Preparar output
            Dictionary <String, HoningNode <String> > output;
            Dictionary <String, HoningNode <String> > output_spell;
            Dictionary <String, HoningNode <String> > output_others;

            // Resultados para uso no site
            result = new List <String>();

            // Preparar entradas da rede de honing
            HoningNode <String> working_node = net.getHoningNode(card_name);
            List <String>       bridges      = new List <String>();

            if (working_node == null)
            {
                return;
            }

            foreach (KeyValuePair <String, HoningNode <String> > key_pair in working_node.clique)
            {
                bridges.Add(key_pair.Value.holder);
            }

            List <String> spellList  = new List <string>();
            List <String> minionList = new List <string>();

            spellList.Add("spell");
            minionList.Add("minion");

            // Recrutamento de neurds
            net.recruitNeurds(bridges, out output);//, spellList);
            //net.recruitNeurds(bridges, out output_spell, minionList);

            net.keepWithMicrofeature(ref output, out output_others, "minion");
            net.keepWithMicrofeature(ref output, out output_spell, "spell");



            // Verifica validade do threshold
            if (threshold > 1.0f)
            {
                threshold = 1.0f;
            }

            Random rand_obj = new Random();

            HoningNode <String> node = net.getHoningNode("Malygos");



            // Prepara'cao final de output para o site
            while (return_count > 0)
            {
                foreach (KeyValuePair <String, HoningNode <String> > key_pair in output)
                {
                    float rand_prob = (float)rand_obj.NextDouble();

                    if (rand_prob >= threshold)
                    {
                        result.Add(key_pair.Key);
                        return_count--;
                        break;
                    }
                } // Fim foreach
            }     // Fim while*/
        }         // Fim seek_by_card