Exemple #1
0
        private void PlayerWon()
        {
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.Write("User wins! What Animal were you thinking of ? ");

            string strUserAnimal = Console.ReadLine();

            Console.Write("what's different betwen a " + outputMessage + " and " + strUserAnimal + ": ");

            string strQuestion = Console.ReadLine().ToLower();

            Console.Write("If thinking of a " + strUserAnimal + ", what would be the answer? ");
            char chrInput = Answer();

            if (chrInput == 'y')
            {
                inputNo  = new ChildBinaryTreeNode(outputMessage);
                inputYes = new ChildBinaryTreeNode(strUserAnimal);
            }

            else if (chrInput == 'n')
            {
                inputYes = new ChildBinaryTreeNode(outputMessage);
                inputNo  = new ChildBinaryTreeNode(strUserAnimal);
            }
            Console.Write("Stored in memory");
            StoreMessage(strQuestion);
        }
Exemple #2
0
        public ChildBinaryTreeNode(string strMessage)
        {
            outputMessage = strMessage;

            inputNo  = null;
            inputYes = null;
        }
        public BinaryTreeRoot(string strQuestion, string strYes,
                              string strNo)
        {
            inputRoot = new ChildBinaryTreeNode(strQuestion);

            inputRoot.StoreYes(new ChildBinaryTreeNode(strYes));
            inputRoot.StoreNo(new ChildBinaryTreeNode(strNo));
        }
Exemple #4
0
 public void StoreYes(ChildBinaryTreeNode btnNode)
 {
     inputYes = btnNode;
 }
Exemple #5
0
 public void StoreNo(ChildBinaryTreeNode btnNode)
 {
     inputNo = btnNode;
 }