예제 #1
0
        public override void InOrder(NodeDungeon rootNodeDungeon, int purpose)
        {
            if (rootNodeDungeon != null)
            {
                InOrder(rootNodeDungeon.LeftChild, purpose);
                switch (purpose)
                {
                case 0:     // Create room.
                    ;
                    break;

                case 1:     // Get room from NodeDungeon, for printing.
                    ;
                    break;

                case 2:     // If room has no children, create new children
                    CreateNewNodeDungeonsFromLeaf(rootNodeDungeon);
                    break;

                case 3:     // Debugging, writes the toString to console.
                    System.Console.WriteLine(rootNodeDungeon.ToString());
                    break;

                default:     // Create room, again, i guess, as a temporary thing.
                    ;
                    break;
                }
                // This (the switch case) is placed here, in the middle, with the purpose of only
                // poking around with the data once, after we've exhausted the
                // left part of the tree. Or, i might be wrong. Anywhyhow...
                InOrder(rootNodeDungeon.RightChild, purpose);
            }
        }
예제 #2
0
        public virtual void InOrder(NodeDungeon rootNodeDungeon, int purpose)
        {
            if (rootNodeDungeon != null)
            {
                InOrder(rootNodeDungeon.LeftChild, purpose);
                switch (purpose)
                {
                case 0:
                    System.Console.WriteLine(rootNodeDungeon.ToString());
                    break;

                default:     // Create room, again, i guess, as a temporary thing.
                    ;
                    break;
                }
                InOrder(rootNodeDungeon.RightChild, purpose);
            }
        }