Пример #1
0
        public static BinaryFeature encodePlayed(Playfield pf)
        {
            Player mPlayer = pf.getCurrentPlayer(true);
            Player ePlayer = pf.getCurrentPlayer(false);

            BinaryFeature ret = new OneDBinaryFeature(FeatureConst.Instance.cardArray.Length);

            foreach (Action action in mPlayer.playactions)
            {
                if (action.actionType == actionEnum.playcard)
                {
                    int idx = FeatureConst.Instance.cardIdxDict[action.card.card.name];
                    if (ret.data[idx] < 2)
                    {
                        ret.data[idx]++;
                    }
                }
                else if (action.actionType == actionEnum.playcard)
                {
                    ret.data[FeatureConst.Instance.heroPowerIdx] = 1;
                }
            }

            return(ret);
        }
Пример #2
0
        public static BinaryFeature EncodeGlobal(Playfield pf)
        {
            Player mPlayer   = pf.getCurrentPlayer(true);
            Player ePlayer   = pf.getCurrentPlayer(false);
            int    ownMana   = mPlayer.ownMaxMana;
            int    enemyMana = ePlayer.ownMaxMana;
            int    ownHp     = mPlayer.ownHero.getHeroHpValue();
            int    enemyHp   = ePlayer.ownHero.getHeroHpValue();
            int    glbIdx    = 0;

            glbIdx += ownMana - 1;

            BinaryFeature globalFeature = new OneDBinaryFeature(36);

            globalFeature.data[glbIdx] = 1;

            glbIdx = 10;
            if (!pf.isOwnTurn)
            {
                globalFeature.data[glbIdx] = 1;
            }

            int heroIdx = FeatureConst.Instance.heroHpDict[ownHp + enemyHp * 10];

            glbIdx += heroIdx;
            globalFeature.data[glbIdx] = 1;

            return(globalFeature);
        }
Пример #3
0
        public static BinaryFeature encodePlay(Playfield pf)
        {
            Player mPlayer = pf.getCurrentPlayer(true);
            Player ePlayer = pf.getCurrentPlayer(false);

            BinaryFeature ret = new OneDBinaryFeature(FeatureConst.Instance.cardArray.Length);

            foreach (Handmanager.Handcard hc in mPlayer.owncards)
            {
                if (hc.canplayCard(pf, pf.isOwnTurn))
                {
                    int idx = FeatureConst.Instance.cardIdxDict[hc.card.name];
                    ret.data[idx] = 1;
                }
            }

            if (mPlayer.mana >= 2 && mPlayer.ownAbilityReady)
            {
                ret.data[FeatureConst.Instance.heroPowerIdx] = 1;
            }

            return(ret);
        }