Ejemplo n.º 1
0
 static void GrayNode(NodeAttributeMap attr)
 {
     if (IsHtmlColor(attr.fillcolor))
     {
         attr.fillcolor = GradientHtmlColor(attr.fillcolor, Color.FromArgb(255, 200, 200, 200), 0.4);
     }
 }
Ejemplo n.º 2
0
        protected override void OnTreeEndFunc(TreeT tree, NodeT root)
        {
            NodeAttributeMap na = new NodeAttributeMap();

            na.fontsize    = 22;
            na.style       = "bold";
            na.peripheries = 0;

            EdgeAttributeMap ea = new EdgeAttributeMap();

            ea.style = "invis";

            _output.WriteLine("{");

            for (int r = -1; r <= _maxRound; ++r)
            {
                string roundName = GetGvRoundName(r);
                na.label = "Round " + r.ToString();
                WriteNode("round" + roundName, na);
                if (r > 0)
                {
                    string prevRoundName = GetGvRoundName(r - 1);
                    WriteEdge("round" + prevRoundName.ToString(), "round" + roundName, ea);
                }
            }
            _output.WriteLine("}");

            base.OnTreeEndFunc(tree, root);
        }
Ejemplo n.º 3
0
            private void PrintChangedValue(Sbr.TreeNode node, NodeAttributeMap attr, double eqValue)
            {
                double delta = (-node.Value) - eqValue;
                string color = delta >= 0 ? "#006600" : "#BB0000";

                attr.label = String.Format("< <FONT POINT-SIZE=\"10\" FACE=\"ARIAL\">id:{0}<BR/>v:{1:0.0000}<BR/><FONT COLOR=\"{2}\" >Δ:{3:0.0000}</FONT></FONT> >",
                                           node.Id, -node.Value, color, delta);
            }
Ejemplo n.º 4
0
            protected override void CustomizeNodeAttributes(ClusterTree tree, IClusterNode node, List <Context> stack, int depth,
                                                            NodeAttributeMap attr)
            {
                Context context = stack[depth];

                base.CustomizeNodeAttributes(tree, node, stack, depth, attr);
                string label = attr.label;

                if (ShowDealPath)
                {
                    label = "c: " + context.Cards + ".\\n" + label;
                }
                attr.label = label;
            }
Ejemplo n.º 5
0
        private void VisNodeImpl(TreeT tree, NodeT node, List <ContextT> stack, int depth)
        {
            NodeAttributeMap attr       = new NodeAttributeMap();
            bool             isNewRound = false;

            if (depth == 0 || stack[depth - 1].Round < stack[depth].Round)
            {
                isNewRound = true;
                string roundName = GetGvRoundName(stack[depth].Round);
                _output.WriteLine("{{rank=same; round{0};", roundName);
            }
            CustomizeNodeAttributes(tree, node, stack, depth, attr);
            WriteNode(stack[depth].GvId, attr);
            if (isNewRound)
            {
                _output.WriteLine("}");
            }
        }
Ejemplo n.º 6
0
            protected override void CustomizeNodeAttributes(UFToUniAdapter aTree, int n, List <Context> stack, int depth, NodeAttributeMap attr)
            {
                Context      context = stack[depth];
                StrategyTree tree    = (StrategyTree)aTree.UfTree;

                base.CustomizeNodeAttributes(aTree, n, stack, depth, attr);
                string nodeLabel = attr.label;

                nodeLabel += string.Format("\\ngv:{0:0.000}", Solver._ptExt[Position][n].GameValue);
                if (!tree.Nodes[n].IsDealerAction && n > 0)
                {
                    nodeLabel += string.Format("\\ns:{0:0.0000}", tree.Nodes[n].Probab);
                }
                if (tree.Nodes[n].IsDealerAction)
                {
                    nodeLabel += string.Format("\\nc:{0}", tree.Nodes[n].Card);
                }
                if (context.IsLeaf)
                {
                    nodeLabel += string.Format("\\npf:{0:0.0000}", Solver._ptExt[Position][n].PotFactor);
                    nodeLabel += string.Format("\\nati:{0}", Solver._ptExt[Position][n].AtIdx);
                }
                if (n == 0)
                {
                    nodeLabel += string.Format("\\nGV:{0:0.000}", Solver.LastBrValues[Position]);
                }
                attr.label = nodeLabel;
            }
Ejemplo n.º 7
0
        protected override void CustomizeNodeAttributes(ObviousMoveSolver.TreeNode tree, ObviousMoveSolver.TreeNode node, List <Context> stack, int depth, NodeAttributeMap attr)
        {
            base.CustomizeNodeAttributes(tree, node, stack, depth, attr);
            string label    = "";
            int    fontSize = 15;
            string color    = "#A0A0A0";

            if (node.Var_h >= 0)
            {
                label = Solver.Vars.GetName(node.Var_h);
                if (node.State.HasPlayerActed(Solver.HeroPosition))
                {
                    color = "#000000";
                }
                label = String.Format("<<FONT FACE = \"ARIAL\" COLOR=\"{2}\" POINT-SIZE=\"{0}\">{1}</FONT>", fontSize, label, color);
            }
            else
            {
                label = "<";
            }
            switch (Solver.HeroPosition)
            {
            case 0:
                switch (node.Id)
                {
                case 5: label += String.Format("<BR/>{0}", "0.1"); break;

                case 12: label += String.Format("<BR/>{0}", "0.3"); break;

                case 25: label += String.Format("<BR/>{0}", "0.2"); break;
                }
                break;

            case 1:
                switch (node.Id)
                {
                case 8: label += String.Format("<BR/>{0}", "1.1"); break;

                case 12: label += String.Format("<BR/>{0}", "1.3"); break;

                case 26: label += String.Format("<BR/>{0}", "1.2"); break;
                }
                break;
            }
            label     += ">";
            attr.label = label;

            // Draw unplayed nodes grayed
            if (IsHtmlColor(attr.fillcolor))
            {
                switch (Solver.HeroPosition)
                {
                case 0:
                    switch (node.Id)
                    {
                    case 7:
                    case 26:
                        GrayNode(attr);
                        break;
                    }
                    break;

                case 1:
                    switch (node.Id)
                    {
                    case 10:
                    case 27:
                        GrayNode(attr);
                        break;
                    }
                    break;
                }
            }
        }
Ejemplo n.º 8
0
        protected override void CustomizeNodeAttributes(Calculator.TreeNode tree, Calculator.TreeNode node, List <Context> stack, int depth, NodeAttributeMap attr)
        {
            base.CustomizeNodeAttributes(tree, node, stack, depth, attr);
            string label    = "";
            int    fontSize = 15;

            if (node.State.HasPlayerActed(Solver.HeroPosition))
            {
                label = String.Format("<<FONT FACE = \"ARIAL\" POINT-SIZE=\"{0}\">{1}</FONT>>", fontSize, FlatStrategy[node.Id]);
            }
            attr.label = label;
        }
Ejemplo n.º 9
0
        protected override void CustomizeNodeAttributes(TreeT tree, NodeT node, List <ContextT> stack, int depth, NodeAttributeMap attr)
        {
            ContextT context = stack[depth];

            attr.label = GetNodeLabel(tree, node, stack, depth);

            if (context.ChildPosition >= 0 && context.ChildPosition < CurrentActorFillColor.Length)
            {
                attr.fillcolor = CurrentActorFillColor[context.ChildPosition];
            }
            else
            {
                attr.fillcolor = "#FFFFFF";
            }

            attr.style = "filled";

            if (context.IsGameOver)
            {
                attr.shape = "box";
            }
            else
            {
                if (context.IsDealerAction)
                {
                    attr.shape = "ellipse";
                }
                else
                {
                    attr.shape = "box";
                }
            }
            if (IsInActionPath(stack, depth))
            {
                attr.style = "bold";
            }
        }