private double[] GetPokeAttr(Pokemon p)
        {
            System.Data.DataTable tab = new System.Data.DataTable();

            tab.Columns.Add("Body");
            tab.Columns.Add("Color");
            tab.Columns.Add("Habitat");
            tab.Columns.Add("Ability1");
            tab.Columns.Add("Ability2");
            tab.Columns.Add("Exp");

            tab.Rows.Add(discPokeMatrix.Rows[p.Id]);
            return codebook.Apply(tab).Rows[0].ItemArray.Select(o => Convert.ToDouble(o)).ToArray();
        }
        static void ParseStatsBase()
        {
            string file = (new StreamReader(Path.Combine(pokefolder, "pokeStats.txt"))).ReadToEnd();
            var pokes = file.Replace('\r', ' ').Split('\n');

            foreach (var poke in pokes)
            {
                var infos = poke.Split('|');
                int pokeId;
                int idInx = 0;
                int hpInx = 2;
                int attkInx = 3;
                int defInx = 4;
                int spAttkInx = 5;
                int spDefInx = 6;
                int speedInx = 7;

                if (int.TryParse(infos[0], out pokeId))// sucesso no parse! é um pokemon valido, sem letra no final
                {

                    var pokeBase = ct.Pokemons.Where(p => p.PokeId == pokeId).FirstOrDefault(); // Doing a query to find the pokemon with this ID
                    if (pokeBase != null) // if the pokemons exists, we just set the bodytype !
                    {
                        pokeBase.BaseHp = int.Parse(infos[hpInx]);
                        pokeBase.BaseAttack = int.Parse(infos[attkInx]);
                        pokeBase.BaseDefense = int.Parse(infos[defInx]);
                        pokeBase.BaseSpAttack = int.Parse(infos[spAttkInx]);
                        pokeBase.BaseSpDefense = int.Parse(infos[spDefInx]);
                        pokeBase.BaseSpeed = int.Parse(infos[speedInx]);

                    }
                    else // if the variabel is null, then the pokemon doenst exists in the database, let's create it!
                    {
                        pokeBase = new Pokemon();
                        pokeBase.PokeId = pokeId;
                        pokeBase.BaseHp = int.Parse(infos[hpInx]);
                        pokeBase.BaseAttack = int.Parse(infos[attkInx]);
                        pokeBase.BaseDefense = int.Parse(infos[defInx]);
                        pokeBase.BaseSpAttack = int.Parse(infos[spAttkInx]);
                        pokeBase.BaseSpDefense = int.Parse(infos[spDefInx]);
                        pokeBase.BaseSpeed = int.Parse(infos[speedInx]);

                    }
                    ct.SaveChanges();
                }
            }
        }
 public bool Classify(Pokemon poke, out int res)
 {
     res = knnPoke.Compute(  GetPokeAttr(poke) );
     return (res == (int)poke.Type);
 }
 private void foo()
 {
     var p = new Pokemon();
     var a = default(Pokemon).Type;
 }