//---------------------------------------------------------------------------------------------------------------------------------------------------
// <copyright file="Test.cs" company="DarkWynter Studios">
//     Copyright (C)2007 DarkWynter Studios.  All rights reserved.
// </copyright>
//---------------------------------------------------------------------------------------------------------------------------------------------------
// {Contact : darkwynter.com for licensing information
//---------------------------------------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Text;

namespace DarkWynter.Engine.Compiler
{
    class Test
    {
        public void TreeTraversal()
        {
            Tree myTree = new Tree();
            depthFirstSearch(myTree.root);
        }
        public void depthFirstSearch(Node node)
        {
            Thought.moveTo(node);
            //BASE CASE
            if ((node.returnRight() == null) && (node.returnLeft() == null))
            {
                return;
            }
            //RECURSIVE CASE
            else
            {
                if (node.returnRight() != null)
                {
                    depthFirstSearch(node.returnRight());
                    Thought.moveTo(node);
                }

                if (node.returnLeft() != null)
                {
                    depthFirstSearch(node.returnLeft());
                    Thought.moveTo(node);
                }
            }
            return;
        }
    }
}