Beispiel #1
0
        static void Main(string[] args)
        {
            BinTree tqTree = new BinTree();

            // tqTree.HardWire();			    // Used before ReadTree() worked
            tqTree.ReadTree();
            //  tqTree.Traverse();			// Uncomment for debug

            string answer;

            Console.WriteLine("Welcome to 20 questions!  I'll try to guess your person.");

            do
            {
                Console.WriteLine();

                Play20Q.PlayOneRound(tqTree);

                Console.Write("\nHow about another game? y,n ");
                answer = Console.ReadLine().ToLower();
            } while (answer.Equals("y"));

            tqTree.SaveTheTree();
            // tqTree.Traverse();            // Uncomment for debug
            Console.WriteLine("Bye Bye!");
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            BinTree tqTree = new BinTree();

            //tqTree.HardCode();                      //  Used until ReadTree() works
            tqTree.ReadTree();

            //tqTree.Traverse();                    //  Uncomment for debug

            //  Check if the tree is empty
            if (tqTree.Root == null)
            {
                Console.WriteLine("Sorry we can't play a game right now.\nCome back later after I learn something.");
            }
            else
            {
                string answer;
                Console.WriteLine("Welcome to 20 questions!\nI'll try to guess your person.");

                do
                {
                    Console.WriteLine();

                    Play20Q.PlayOneGame(tqTree);

                    Console.Write("\nHow about another game?(y, n) ");
                    answer = Console.ReadLine();
                } while (answer.Equals("y"));


                tqTree.SaveTheTree();
                //tqTree.Traverse();			        //  Uncomment for debug
            }

            Console.WriteLine("Bye Bye!");
            Console.ReadKey();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            BinTree tqTree = new BinTree();

            //tqTree.HardCode();              // Used before ReadTree() worked
            tqTree.ReadTree();

            string answer;

            Console.WriteLine("Welcome to 20 questions!  I'll try to guess your person.");

            do
            {
                Console.WriteLine();

                Play20Q.PlayR(tqTree, tqTree.root); //got this to work for both a single game and multiple games

                Console.Write("\nHow about another game? ");
                answer = Console.ReadLine();
            } while (answer.Equals("y"));

            tqTree.SaveTree();
            Console.WriteLine("Bye Bye!");
        }