Exemplo n.º 1
0
 public AISolver(Grid g, AISettings s)
 {
     grid      = g;
     settings  = s;
     heuristic = new AIHeuristic()
     {
         Values = s.weights
     };
 }
Exemplo n.º 2
0
        protected override void Start()
        {
            base.Start();

            var game = PonGameScript.instance;

            aiSettings = player.GetAISettings(); // Get it from settings!

            var weights = aiSettings.weights;

            // Add weights on objectives if we have some
            if (game != null && game.Objectives != null)
            {
                var objs = game.Objectives.GetSubObjectives();
                if (objs.Count > 0)
                {
                    if (objs.Any(o => o.totalCombos > 0))
                    {
                        weights.combo3 += weights.objective;
                    }

                    if (objs.Any(o => o.total4Combos > 0))
                    {
                        weights.combo4 += weights.objective;
                    }

                    if (objs.Any(o => o.total5Combos > 0))
                    {
                        weights.combo5 += weights.objective;
                    }

                    if (objs.Any(o => o.totalLCombos > 0))
                    {
                        weights.comboL += weights.objective;
                    }

                    if (objs.Any(o => o.timeReached > 0))
                    {
                        weights.danger += weights.objective;
                    }
                }
            }

            aiSettings.weights = weights;

            initialCooldown = aiSettings.initialCooldown;
        }