Esempio n. 1
0
 public void setInstances()
 {
     help     = Helpfunctions.Instance;
     penman   = PenalityManager.Instance;
     settings = Settings.Instance;
     cdb      = CardDB.Instance;
 }
Esempio n. 2
0
        private void cuttingposibilities(Bot botBase)
        {
            // take the x best values
            int takenumber        = this.maxwide;
            List <Playfield> temp = new List <Playfield>();

            posmoves.Sort((a, b) => - (botBase.getPlayfieldValue(a)).CompareTo(botBase.getPlayfieldValue(b)));//want to keep the best
            temp.AddRange(posmoves);
            posmoves.Clear();
            posmoves.AddRange(Helpfunctions.TakeList(temp, takenumber));
        }
Esempio n. 3
0
        public void sendCurrentBoardToClient()
        {
            //bool runEx = true;
            Helpfunctions hpf      = Helpfunctions.Instance;
            player        p        = p2;
            player        opponent = p1;

            if (this.currentplayer)
            {
                p        = p1;
                opponent = p2;
            }

            //DO we need this?
            //hpf.resetBuffer();
            //hpf.writeBufferToActionFile(p.client);
            hpf.resetBuffer();

            string dtimes = DateTime.Now.ToString("HH:mm:ss:ffff");

            /*int ownsecretcount = p.secrets.Count;
             * int enemySecretCount = opponent.secrets.Count;
             *
             * string enemysecretIds = "";
             * enemysecretIds = Probabilitymaker.Instance.getEnemySecretData();
             *
             *
             * hpf.writeToBuffer("#######################################################################");
             * hpf.writeToBuffer("#######################################################################");
             * hpf.writeToBuffer("start calculations, current time: " + dtimes + " V" + "115.55" + " " + p.settings);
             * hpf.writeToBuffer("#######################################################################");
             * hpf.writeToBuffer("mana " + p.curMana + "/" + p.maxMana);
             * hpf.writeToBuffer("emana " + opponent.maxMana);
             * hpf.writeToBuffer("own secretsCount: " + ownsecretcount);
             * hpf.writeToBuffer("enemy secretsCount: " + enemySecretCount + " ;" + enemysecretIds);
             *
             * Hrtprozis.Instance.printHero(runEx);
             * Hrtprozis.Instance.printOwnMinions(runEx);
             * Hrtprozis.Instance.printEnemyMinions(runEx);
             * Handmanager.Instance.printcards(runEx);
             * Probabilitymaker.Instance.printTurnGraveYard(runEx);
             * Probabilitymaker.Instance.printGraveyards(runEx);*/

            hpf.writeToBuffer(this.board.getCompleteBoardForSimulating(p.settings, "116.00", dtimes));
            hpf.writeBufferToFile(p.client);
            hpf.ErrorLog("sended");
        }
Esempio n. 4
0
 public void setInstances()
 {
     help = Helpfunctions.Instance;
     cdb  = CardDB.Instance;
 }
Esempio n. 5
0
        public void print(bool tobuffer = false)
        {
            Helpfunctions help = Helpfunctions.Instance;

            if (tobuffer)
            {
                if (this.actionType == actionEnum.playcard)
                {
                    string playaction = "play ";

                    playaction += "id " + this.card.entity;
                    if (this.target != null)
                    {
                        playaction += " target " + this.target.entitiyID;
                    }

                    if (this.place >= 0)
                    {
                        playaction += " pos " + this.place;
                    }

                    if (this.druidchoice >= 1)
                    {
                        playaction += " choice " + this.druidchoice;
                    }

                    help.writeToBuffer(playaction);
                }
                if (this.actionType == actionEnum.attackWithMinion)
                {
                    help.writeToBuffer("attack " + this.own.entitiyID + " enemy " + this.target.entitiyID);
                }
                if (this.actionType == actionEnum.attackWithHero)
                {
                    help.writeToBuffer("heroattack " + this.target.entitiyID);
                }
                if (this.actionType == actionEnum.useHeroPower)
                {
                    if (this.target != null)
                    {
                        help.writeToBuffer("useability on target " + this.target.entitiyID);
                    }
                    else
                    {
                        help.writeToBuffer("useability");
                    }
                }
                return;
            }
            if (this.actionType == actionEnum.playcard)
            {
                string playaction = "play ";

                playaction += "id " + this.card.entity;
                if (this.target != null)
                {
                    playaction += " target " + this.target.entitiyID;
                }

                if (this.place >= 0)
                {
                    playaction += " pos " + this.place;
                }

                if (this.druidchoice >= 1)
                {
                    playaction += " choice " + this.druidchoice;
                }

                help.logg(playaction);
            }
            if (this.actionType == actionEnum.attackWithMinion)
            {
                help.logg("attacker: " + this.own.entitiyID + " enemy: " + this.target.entitiyID);
            }
            if (this.actionType == actionEnum.attackWithHero)
            {
                help.logg("attack with hero, enemy: " + this.target.entitiyID);
            }
            if (this.actionType == actionEnum.useHeroPower)
            {
                help.logg("useability ");
                if (this.target != null)
                {
                    help.logg("on enemy: " + this.target.entitiyID);
                }
            }
            help.logg("");
        }
Esempio n. 6
0
 private Questmanager()
 {
     this.help = Helpfunctions.Instance;
 }
Esempio n. 7
0
        public void print(bool tobuffer = false)
        {
            Helpfunctions help     = Helpfunctions.Instance;
            string        discover = "";

            if (this.tracking >= 1)
            {
                discover = " discover " + tracking;
            }
            if (tobuffer)
            {
                if (this.actionType == actionEnum.playcard)
                {
                    string playaction = "play ";

                    playaction += "id " + this.card.entity;
                    if (this.target != null)
                    {
                        playaction += " target " + this.target.entityID;
                    }

                    if (this.place >= 0)
                    {
                        playaction += " pos " + this.place;
                    }

                    if (this.druidchoice >= 1)
                    {
                        playaction += " choice " + this.druidchoice;
                    }

                    help.writeToBuffer(playaction + discover);
                }
                if (this.actionType == actionEnum.attackWithMinion && this.target != null)
                {
                    help.writeToBuffer("attack " + this.own.entityID + " enemy " + this.target.entityID + discover);
                }
                if (this.actionType == actionEnum.attackWithHero && this.target != null)
                {
                    help.writeToBuffer("heroattack " + this.target.entityID + discover);
                }
                if (this.actionType == actionEnum.useHeroPower)
                {
                    if (this.target != null)
                    {
                        help.writeToBuffer("useability on target " + this.target.entityID + discover);
                    }
                    else
                    {
                        help.writeToBuffer("useability" + discover);
                    }
                }
                return;
            }

            //todo sepefeets - consider adding names into actions from the start instead of mapping them here
            string    cardname   = "";
            string    targetname = "";
            Playfield tmpPf      = new Playfield();

            if (this.target != null)
            {
                foreach (Minion m in tmpPf.enemyMinions)
                {
                    if (m.entityID == this.target.entityID)
                    {
                        targetname = "" + m.name;
                    }
                }
                if (tmpPf.enemyHero.entityID == this.target.entityID)
                {
                    targetname = "" + tmpPf.enemyHeroName;
                }
            }
            foreach (Minion m in tmpPf.ownMinions)
            {
                if (this.target != null && m.entityID == this.target.entityID)
                {
                    targetname = "" + m.name;
                }
                if (this.card != null && m.entityID == this.card.entity)
                {
                    cardname = "" + m.name;
                }
                if (this.own != null && m.entityID == this.own.entityID)
                {
                    cardname = "" + m.name;
                }
            }
            if (this.target != null && tmpPf.ownHero.entityID == this.target.entityID)
            {
                targetname = "" + tmpPf.ownHeroName;
            }
            foreach (Handmanager.Handcard h in tmpPf.owncards)
            {
                if (this.card != null && h.entity == this.card.entity)
                {
                    cardname = "" + h.card.name;
                }
            }


            if (this.actionType == actionEnum.playcard && this.card != null)
            {
                string playaction = "play ";
                playaction += cardname;
                playaction += " id " + this.card.entity;

                if (this.target != null)
                {
                    playaction += ", target " + targetname + " id " + this.target.entityID;
                }

                if (this.place >= 0)
                {
                    playaction += ", pos " + this.place;
                }

                if (this.druidchoice >= 1)
                {
                    playaction += ", choice " + this.druidchoice;
                }

                help.logg(playaction + discover);
            }
            if (this.actionType == actionEnum.attackWithMinion && this.target != null && this.own != null)
            {
                help.logg("attacker: " + cardname + " id " + this.own.entityID + ", enemy: " + targetname + " id " + this.target.entityID + discover);
            }
            if (this.actionType == actionEnum.attackWithHero && this.target != null)
            {
                help.logg("attack with hero, enemy: " + targetname + " id " + this.target.entityID + discover);
            }
            if (this.actionType == actionEnum.useHeroPower)
            {
                help.logg("useability " + discover);
                if (this.target != null)
                {
                    help.logg("on " + (target.own ? "own " : "enemy ") + targetname + " id " + this.target.entityID + discover);
                }
            }
        }
Esempio n. 8
0
 public void setInstances()
 {
     this.help = Helpfunctions.Instance;
 }
Esempio n. 9
0
 private Handmanager()
 {
     this.help = Helpfunctions.Instance;
 }
Esempio n. 10
0
        private Handmanager()
        {
            this.help = Helpfunctions.Instance;

            int       i = 0;
            Cardsposi c = new Cardsposi();

            c.Amount          = 1;
            c.DetectPosix     = 450;
            c.DetectPosiy     = 675;
            c.cardsHooverPosx = 490;
            c.cardsHooverdiff = 1;
            c.cardsBigPosx    = 366;
            c.cardsBigdiff    = 1;
            this.cardsdata.Add(c);

            i                 = i + 1;
            c                 = new Cardsposi();
            c.Amount          = 2;
            c.DetectPosix     = 403;
            c.DetectPosiy     = 674;
            c.cardsHooverPosx = 438;
            c.cardsHooverdiff = 100;
            c.cardsBigPosx    = 317;
            c.cardsBigdiff    = 99;
            this.cardsdata.Add(c);

            i                 = i + 1;
            c                 = new Cardsposi();
            c.Amount          = 3;
            c.DetectPosix     = 356;
            c.DetectPosiy     = 675;
            c.cardsHooverPosx = 390;
            c.cardsHooverdiff = 100;
            c.cardsBigPosx    = 267;
            c.cardsBigdiff    = 99;
            this.cardsdata.Add(c);

            i                 = i + 1;
            c                 = new Cardsposi();
            c.Amount          = 4;
            c.DetectPosix     = 291;
            c.DetectPosiy     = 715;
            c.cardsHooverPosx = 350;
            c.cardsHooverdiff = 90;
            c.cardsBigPosx    = 220;
            c.cardsBigdiff    = 97;
            this.cardsdata.Add(c);

            i                 = i + 1;
            c                 = new Cardsposi();
            c.Amount          = 5;
            c.DetectPosix     = 280;
            c.DetectPosiy     = 712;
            c.cardsHooverPosx = 340;
            c.cardsHooverdiff = 75;
            c.cardsBigPosx    = 210;
            c.cardsBigdiff    = 78;
            this.cardsdata.Add(c);

            i                 = i + 1;
            c                 = new Cardsposi();
            c.Amount          = 6;
            c.DetectPosix     = 273;
            c.DetectPosiy     = 726;
            c.cardsHooverPosx = 323;
            c.cardsHooverdiff = 65;
            c.cardsBigPosx    = 204;
            c.cardsBigdiff    = 65;
            this.cardsdata.Add(c);

            i                 = i + 1;
            c                 = new Cardsposi();
            c.Amount          = 7;
            c.DetectPosix     = 267;
            c.DetectPosiy     = 724;
            c.cardsHooverPosx = 314;
            c.cardsHooverdiff = 56;
            c.cardsBigPosx    = 199;
            c.cardsBigdiff    = 56;
            this.cardsdata.Add(c);

            i                 = i + 1;
            c                 = new Cardsposi();
            c.Amount          = 8;
            c.DetectPosix     = 262;
            c.DetectPosiy     = 740;
            c.cardsHooverPosx = 300;
            c.cardsHooverdiff = 47;
            c.cardsBigPosx    = 196;
            c.cardsBigdiff    = 49;
            this.cardsdata.Add(c);

            i                 = i + 1;
            c                 = new Cardsposi();
            c.Amount          = 9;
            c.DetectPosix     = 260;
            c.DetectPosiy     = 738;
            c.cardsHooverPosx = 295;
            c.cardsHooverdiff = 42;
            c.cardsBigPosx    = 193;
            c.cardsBigdiff    = 43;
            this.cardsdata.Add(c);

            i                 = i + 1;
            c                 = new Cardsposi();
            c.Amount          = 10;
            c.DetectPosix     = 257;
            c.DetectPosiy     = 752;
            c.cardsHooverPosx = 286;
            c.cardsHooverdiff = 38;
            c.cardsBigPosx    = 191;
            c.cardsBigdiff    = 39;
            this.cardsdata.Add(c);
        }
Esempio n. 11
0
 public void setInstances()
 {
     this.help     = Helpfunctions.Instance;
     this.penman   = PenalityManager.Instance;
     this.settings = Settings.Instance;
 }