public void Visualize(string fileName) { using (TextWriter output = new StreamWriter(fileName)) { var vis = new Vis { Output = output }; vis.Walk(this, Root); } }
public void Test_GenerateFiles() { string libDir = Path.GetFileNameWithoutExtension(CodeBase.Get(Assembly.GetExecutingAssembly())); string dataDir = Props.Global.Get("bds.DataDir"); string workingDir = Directory.GetCurrentDirectory() + @"..\..\..\..\"; GameDefinition gd = XmlSerializerExt.Deserialize <GameDefinition>( Path.Combine(dataDir, "ai.pkr.metastrategy.kuhn.gamedef.1.xml")); using (TextWriter tw = new StreamWriter(Path.Combine(workingDir, "p1.gv"))) { GenTree tree = new GenTree { GameDef = gd, Kind = GenTree.TreeKind.PlayerTree, HeroPosition = 1 }; DeckGenNode root = new DeckGenNode(tree, gd.MinPlayers); Vis vis = new Vis { Output = tw }; SetVisAttributes(vis); //vis.ShowExpr.Add(new ExprFormatter("s[d].Node.Id", "id:{1}")); vis.Walk(tree, root); } using (TextWriter tw = new StreamWriter(Path.Combine(workingDir, "g.gv"))) { GenTree tree = new GenTree { GameDef = gd, Kind = GenTree.TreeKind.GameTree, HeroPosition = 0 }; DeckGenNode root = new DeckGenNode(tree, gd.MinPlayers); Vis vis = new Vis { Output = tw }; SetVisAttributes(vis); //vis.ShowExpr.Add(new ExprFormatter("s[d].Node.Id", "id:{1}")); vis.Walk(tree, root); } }