예제 #1
0
        private void PrepareHeroStrategy()
        {
            ChanceTree pct = ExtractPlayerChanceTree.ExtractS(ChanceTree, HeroPosition);

            Strategy = CreateStrategyTreeByChanceAndActionTrees.CreateS(pct, ActionTree);

            string description = String.Format("EQ (LP) pos {0} ", HeroPosition);

            description += String.Format("ct: ({0}), ", ChanceTree.Version.Description);
            description += String.Format("at: ({0})", ActionTree.Version.Description);

            Strategy.Version.Description = description;
        }
예제 #2
0
파일: Br.cs 프로젝트: ivan-alles/poker-acpc
        private void CreateHeroStrategy()
        {
            ChanceTree hct = ExtractPlayerChanceTree.ExtractS(ChanceTree, HeroPosition);

            Strategies[HeroPosition] = CreateStrategyTreeByChanceAndActionTrees.CreateS(hct, ActionTree);

            string description = String.Format("BR pos {0} vs ", HeroPosition);

            for (int p = 0; p < Strategies.Length; ++p)
            {
                if (p == HeroPosition)
                {
                    continue;
                }
                description += String.Format("{0}: ({1}), ", p, Strategies[p].Version.Description);
            }
            description += String.Format("ct: ({0}), ", ChanceTree.Version.Description);
            description += String.Format("at: ({0})", ActionTree.Version.Description);

            Strategies[HeroPosition].Version.Description = description;
        }
예제 #3
0
        void Prepare()
        {
            _oppPosition = 1 - HeroPosition;

            // Create a strategy for each player. We need both because players can use different abstractions.
            PrepareHeroStrategy();
            ChanceTree pct;

            pct          = ExtractPlayerChanceTree.ExtractS(ChanceTree, _oppPosition);
            _oppStrategy = CreateStrategyTreeByChanceAndActionTrees.CreateS(pct, ActionTree);

            _variables     = new Variables();
            _constraintsLE = new List <Constraint>();
            _constraintsEQ = new List <Constraint>();

            PrepareHero();

            // Create index for the chance tree.
            _chanceTreeNodes = new int[PLAYERS_COUNT][][];
            for (int r = 0; r < _roundsCount; ++r)
            {
                int oppSize = _chanceIndexSizes[_oppPosition][r];
                _chanceTreeNodes[r] = new int[oppSize][];
                int heroSize = _chanceIndexSizes[HeroPosition][r];
                for (int i = 0; i < oppSize; ++i)
                {
                    _chanceTreeNodes[r][i] = new int[heroSize];
                }
            }

            WalkUFTreePP <ChanceTree, PrepareChanceIndexContext> wt1 = new WalkUFTreePP <ChanceTree, PrepareChanceIndexContext>();

            wt1.OnNodeBegin = PrepareChanceIndex_OnNodeBegin;
            wt1.Walk(ChanceTree);

            // This will be the index of v0 variable, because it will be added next.
            _v0 = _variables.Count;

            PrepareOpp();
        }