Beispiel #1
0
 public void query(int q)
 {
     if (q > 20)
     {
         Console.WriteLine("That was the last question. You win!");
     }
     else if (this.isQuestion())
     {
         Console.WriteLine(q + ") " + this.message);
         Console.Write("Enter 'y' for yes and 'n' for no: ");
         char input = getYesOrNo(); //y or n
         if (input == 'y')
         {
             yesNode.query(q + 1);
         }
         else
         {
             noNode.query(q + 1);
         }
     }
     else
     {
         this.onQueryObject(q);
     }
 }
Beispiel #2
0
        public void Query()
        {
            rootNode.query(1);

            //We're at the end of the game now, so we'll save the tree in case the user added new data
            this.saveQuestionTree();
        }
Beispiel #3
0
        public void query()
        {
            PrintOrder(rootNode, Order.PreOrder);
            Console.WriteLine(string.Format("Minimax output: {0}", Minimax(rootNode, true)));
            Console.WriteLine(string.Format("ABPruning output: {0}", ABPruning(rootNode, true)));
            rootNode.query(1);

            //We're at the end of the game now, so we'll save the tree in case the user added new data
            this.saveQuestionTree();
        }