public BTNode AddingRoot()
        {//adding root for new yes or no node or question
            Game.start();
            Queue <BTNode> queue = new Queue <BTNode>();

            queue.Enqueue(Game.Roots);

            while (queue.Count > 0)
            {
                BTNode t = queue.Dequeue();
                if (t.GetQuestion() == TRoot.GetQuestion())
                {
                    return(t);
                }
                if (t.GetYesNode() != null)
                {
                    queue.Enqueue(t.GetYesNode());
                }
                if (t.GetNoNode() != null)
                {
                    queue.Enqueue(t.GetNoNode());
                }
            }
            return(null);
        }
Esempio n. 2
0
 private void MainForm_Load(object sender, EventArgs e)
 {
     Game.start();
     TempRoot = Game.Roots;
     q        = TempRoot.GetQuestion();
     MakeQues();
     label2.Text = "Question No:";
 }