Ejemplo n.º 1
0
 public void setInstances()
 {
     help     = Helpfunctions.Instance;
     penman   = PenalityManager.Instance;
     settings = Settings.Instance;
     cdb      = CardDB.Instance;
 }
Ejemplo n.º 2
0
        //private static Ai instance;

        //public static Ai Instance
        //{
        //    get
        //    {
        //        return instance ?? (instance = new Ai());
        //    }
        //}

        public Ai(Silverfish sf)
        {
            this.sf            = sf;
            this.nextMoveGuess = new Playfield(sf);
            PenalityManager penman = sf.PenalityManager;

            hp   = sf.Hrtprozis;
            hm   = sf.Handmanager;
            help = sf.Helpfunctions;

            this.nextMoveGuess = new Playfield(sf)
            {
                mana = -100
            };

            this.mainTurnSimulator = new MiniSimulator(sf, maxdeep, maxwide, 0); // 0 for unlimited
            this.mainTurnSimulator.setPrintingstuff(true);

            /*this.nextTurnSimulator = new MiniSimulatorNextTurn();
             * this.enemyTurnSim = new EnemyTurnSimulator();
             * this.enemySecondTurnSim = new EnemyTurnSimulator();*/

            for (int i = 0; i < sf.Settings.numberOfThreads; i++)
            {
                this.nextTurnSimulator.Add(new MiniSimulatorNextTurn(sf));
                this.enemyTurnSim.Add(new EnemyTurnSimulator(sf));
                this.enemySecondTurnSim.Add(new EnemyTurnSimulator(sf));

                this.nextTurnSimulator[i].thread  = i;
                this.enemyTurnSim[i].thread       = i;
                this.enemySecondTurnSim[i].thread = i;
            }
        }
Ejemplo n.º 3
0
        private void setAdditionalData()
        {
            PenalityManager pen = PenalityManager.Instance;

            foreach (Card c in this.cardlist)
            {
                if (pen.cardDrawBattleCryDatabase.ContainsKey(c.name))
                {
                    c.isCarddraw = pen.cardDrawBattleCryDatabase[c.name];
                }

                if (pen.DamageTargetSpecialDatabase.ContainsKey(c.name))
                {
                    c.damagesTargetWithSpecial = true;
                }

                if (pen.DamageTargetDatabase.ContainsKey(c.name))
                {
                    c.damagesTarget = true;
                }

                if (pen.priorityTargets.ContainsKey(c.name))
                {
                    c.targetPriority = pen.priorityTargets[c.name];
                }

                if (pen.specialMinions.ContainsKey(c.name))
                {
                    c.isSpecialMinion = true;
                }

                c.trigers = new List <cardtrigers>();
                Type trigerType = c.sim_card.GetType();
                foreach (string trigerName in Enum.GetNames(typeof(cardtrigers)))
                {
                    try
                    {
                        foreach (var m in trigerType.GetMethods().Where(e => e.Name.Equals(trigerName, StringComparison.Ordinal)))
                        {
                            if (m.DeclaringType == trigerType)
                            {
                                c.trigers.Add((cardtrigers)Enum.Parse(typeof(cardtrigers), trigerName));
                            }
                        }
                    }
                    catch
                    {
                    }
                }
                if (c.trigers.Count > 10)
                {
                    c.trigers.Clear();
                }
            }
        }
Ejemplo n.º 4
0
        public Silverfish()
        {
            botbase = new BehaviorControl(this);
            //Ai = new Ai(this);
            //Settings = new Settings(this);
            //Helpfunctions = new Helpfunctions(this);
            //Movegenerator = new Movegenerator(this);
            //Hrtprozis = new Hrtprozis(this);
            //Handmanager = new Handmanager(this);
            //Combobreaker = new ComboBreaker(this);
            //PenalityManager = new PenalityManager(this);
            //Probabilitymaker = new Probabilitymaker(this);
            //Mulligan = new Mulligan(this);

            this.singleLog = Settings.writeToSingleFile;
            HRSim.Helpfunctions.Instance.ErrorLog("init Silverfish");
            string path = "";

            //System.IO.Directory.CreateDirectory(path);
            Settings.setFilePath("C:\\Code\\ConsoleApplication1\\ConsoleApplication1\\");

            if (!singleLog)
            {
                Settings.setLoggPath(path);
            }
            else
            {
                Settings.setLoggPath("");
                Settings.setLoggFile("UILogg.txt");
                try
                {
                    HRSim.Helpfunctions.Instance.createNewLoggfile();
                }
                catch
                {
                }
            }
            PenalityManager.setCombos();
        }
Ejemplo n.º 5
0
 public BehaviorRush(Silverfish sf)
 {
     this.sf = sf;
     penman = sf.PenalityManager;
 }
Ejemplo n.º 6
0
 public BehaviorControl(Silverfish sf)
 {
     this.sf = sf;
     penman  = sf.PenalityManager;
 }
Ejemplo n.º 7
0
 public void setInstances()
 {
     this.help     = Helpfunctions.Instance;
     this.penman   = PenalityManager.Instance;
     this.settings = Settings.Instance;
 }
Ejemplo n.º 8
0
        //private static Movegenerator instance;

        //public static Movegenerator Instance
        //{
        //    get
        //    {
        //        return instance ?? (instance = new Movegenerator());
        //    }
        //}

        public Movegenerator(Silverfish sf)
        {
            this.sf = sf;
            pen     = sf.PenalityManager;
        }