Exemplo n.º 1
0
        protected override TreeBase[] CreateChildren()
        {
            NodeType head;
            int      constant = 0;

            if (Level > MaxLevel)
            {
                head = NodeType.End;
            }
            else if (typeA.Contains(type))
            {
                head = SynthTree.NodeType.FlagA;
            }
            else if (typeB.Contains(type))
            {
                head = SynthTree.NodeType.FlagB;
            }
            else
            {
                head = SynthTree.NodeType.FlagW;
            }
            constantCount.TryGetValue(type, out constant);

            return(Enumerable.Repeat(head, 1).Concat(Enumerable.Repeat(NodeType.Constant, constant))
                   .Select(x => TreeGenerator.GetNode(x, Level))
                   .ToArray());
        }
Exemplo n.º 2
0
        protected override TreeBase[] CreateChildren()
        {
            NodeType[] nt;
            int        wc;
            var        ta = NodeType.FlagA | NodeType.FlagType;
            var        tb = NodeType.FlagB | NodeType.FlagType;
            var        tw = NodeType.FlagW | SynthTree.NodeType.FlagType;
            var        fa = Level > MaxLevel ? NodeType.End : NodeType.FlagA;
            var        fb = Level > MaxLevel ? NodeType.End : NodeType.FlagB;
            var        fw = Level > MaxLevel ? NodeType.End : NodeType.FlagW;

            switch (this.type)
            {
            case ModifierType.SeriesA:
                nt = new[] { fa, ta, tb };
                wc = 3;
                break;

            case ModifierType.ParallelA:
                nt = new[] { fa, ta, ta, tb, tb };
                wc = 6;
                break;

            case ModifierType.UnitA:
                nt = new[] { fa, tw };
                wc = 1;
                break;

            case ModifierType.SeriesB:
                nt = new [] { fb, tb, ta };
                wc = 3;
                break;

            case ModifierType.ParallelB:
                nt = new[] { fb, tb, tb, ta, ta };
                wc = 6;
                break;

            case ModifierType.UnitB:
                nt = new[] { fb, tw };
                wc = 1;
                break;

            case ModifierType.UnitW:
                nt = new[] { fw, tw, };
                wc = 1;
                break;

            case ModifierType.LoopW:
                nt = new[] { fw, ta, tb, tw };
                wc = 4;
                break;

            default:
                throw new Exception();
            }

            return(nt /*.Concat(Enumerable.Repeat(NodeType.FlagW, wc))*/.Select(x => TreeGenerator.GetNode(x, Level)).ToArray());
        }
Exemplo n.º 3
0
        protected override TreeBase[] CreateChildren()
        {
            NodeType nt;

            switch (type)
            {
            case ConnectionType.A:
                nt = NodeType.FlagA;
                break;

            case ConnectionType.B:
                nt = NodeType.FlagB;
                break;

            case ConnectionType.W:
                nt = NodeType.FlagW;
                break;

            default:
                throw new Exception();
            }
            return(new[] { TreeGenerator.GetNode(nt, Level) });
        }
Exemplo n.º 4
0
 protected override TreeBase[] CreateChildren()
 {
     return(new[] { TreeGenerator.GetNode(NodeType.FlagA | NodeType.FlagType, Level) });
 }