Ejemplo n.º 1
0
        public List <int> GetAIMoves(Player pl)
        {
            float[][] fmatrix = new float[20][];
            for (int i = 0; i < 20; i++)
            {
                fmatrix[i] = new float[51];
            }

            foreach (var ent in pl.AbilityUpgrades)
            {
                if (!AImoves.Contains(3000 + 1 + (int)ent.Ability))
                {
                    AImoves.Add(3000 + 1 + (int)ent.Ability);
                }
            }

            foreach (var ent in pl.Upgrades)
            {
                if (!AImoves.Contains(3000 + 4 + (int)ent.Upgrade))
                {
                    AImoves.Add(3000 + 4 + (int)ent.Upgrade);
                }
            }

            foreach (var ent in pl.Units.Where(x => x.Status != UnitStatuses.Available))
            {
                int ui  = UnitPool.Units.SingleOrDefault(x => x.Name == ent.Name).ID - 1;
                int uj  = (int)(ent.PlacePos.Y * 2);
                int uk  = (int)(ent.PlacePos.X * 2);
                int num = 0;
                for (int i = 0; i < 3; i++)
                {
                    for (int j = 0; j < 20; j++)
                    {
                        for (int k = 0; k < 50; k++)
                        {
                            if (ui == i && uj == j && uk == k)
                            {
                                if (!AImoves.Contains(num))
                                {
                                    AImoves.Add(num);
                                }
                            }
                            num++;
                        }
                    }
                }
            }
            int mins = 0;


            bool Test = false;

            if (Test)
            {
                foreach (var ent in AImoves)
                {
                    mins += UnitService.ActionToMove(ent);
                }
                Player plbab = pl.Deepcopy();
                BBuild bab   = new BBuild(plbab);
                bab.SetString(bab.GetString(plbab), plbab);
                if (mins != plbab.MineralsCurrent)
                {
                    Console.WriteLine("A2: " + mins + " <=> " + plbab.MineralsCurrent);
                }
            }

            return(AImoves);
        }