Example #1
0
 public ChanceAbstractedGameDefParams(GameValue_Test test, string name, string gameDefFile, IChanceAbstraction[] abstractions,
                                      string[] strategyFiles, double[] expectedResult, double epsilon) :
     base(test, gameDefFile, strategyFiles, expectedResult, epsilon)
 {
     ChanceTree = CreateChanceTreeByAbstraction.CreateS(GameDef, abstractions);
     Name       = name;
 }
Example #2
0
            public OcfrParams(GameValue_Test test, string name, string gameDefFile, IChanceAbstraction[] abstractions, string[] ocfrFiles, double[] expectedResult, double epsilon)
            {
                Epsilon        = epsilon;
                ExpectedResult = expectedResult;

                GameDef = XmlSerializerExt.Deserialize <GameDefinition>(
                    Props.Global.Expand("${bds.DataDir}ai.pkr.metastrategy/${0}",
                                        gameDefFile));

                Name = name;

                OcfrFiles = new string[GameDef.MinPlayers].Fill(i => Path.Combine(test._testResDir, ocfrFiles[i]));
                if (abstractions == null)
                {
                    ChanceTree = CreateChanceTreeByGameDef.Create(GameDef);
                }
                else
                {
                    ChanceTree = CreateChanceTreeByAbstraction.CreateS(GameDef, abstractions);
                }

                //VisChanceTree.Show(ChanceTree, Path.Combine(test._outDir, String.Format("{0}-c.gv", GameDef.Name)));

                ActionTree = CreateActionTreeByGameDef.Create(GameDef);

                StrategyTrees = new StrategyTree[GameDef.MinPlayers];

                for (int p = 0; p < GameDef.MinPlayers; ++p)
                {
                    ChanceTree pct = ExtractPlayerChanceTree.ExtractS(ChanceTree, p);
                    StrategyTrees[p] = CreateStrategyTreeByChanceAndActionTrees.CreateS(pct, ActionTree);


                    OpenCfrStrategyConverter conv = new OpenCfrStrategyConverter
                    {
                        GameDef           = GameDef,
                        HeroPosition      = p,
                        SourceFile        = OcfrFiles[p],
                        Strategy          = StrategyTrees[p],
                        ChanceAbstraction = abstractions == null ? null : abstractions[p]
                    };
                    conv.Convert();

                    //VisStrategyTree.Show(StrategyTrees[p], Path.Combine(test._outDir, String.Format("{0}-str-{1}.gv", GameDef.Name, p)));
                }
            }
Example #3
0
            public GameDefParams(GameValue_Test test, string gameDefFile, string[] strategyFiles, double[] expectedResult, double epsilon)
            {
                Epsilon        = epsilon;
                ExpectedResult = expectedResult;

                GameDef = XmlSerializerExt.Deserialize <GameDefinition>(
                    Props.Global.Expand("${bds.DataDir}ai.pkr.metastrategy/${0}",
                                        gameDefFile));

                Name = GameDef.Name;

                StrategyFiles = new string[GameDef.MinPlayers].Fill(i => Path.Combine(test._testResDir, strategyFiles[i]));

                StrategyTrees = new StrategyTree[GameDef.MinPlayers].Fill(i =>
                                                                          XmlToStrategyTree.Convert(StrategyFiles[i], GameDef.DeckDescr));

                ChanceTree = CreateChanceTreeByGameDef.Create(GameDef);
                ActionTree = CreateActionTreeByGameDef.Create(GameDef);
            }