Question
Q.a Guessing game. In a guessing game, you think of something and I have to guess what it is by asking you questions that have
Q.a Guessing game. In a guessing game, you think of something and I have to guess what it is by asking you questions that have a yes or no answer. Suppose that a program asks the questions for me. This program uses a binary decision tree that grows as the game progresses. Instead of creating the tree before it is used, the program acquires facts from the user and adds them to the decision tree. Thus, the program learns by playing the game and becomes more proficient over time.
can someone tell me howw can I progtam the interface, and how do we implement machine learning here.
1 package TreePackage; 2 public interface DecisionTreeInterface extends BinaryTreeInterface 3 { 4 /** Gets the data in the current node. 5 @return The data object in the current node, or 6 null if the current node is null. */ 7 public T getCurrentData(); 8 9 /** Sets the data in the current node. 10 @param newData The new data object. */ 11 public void setCurrentData(T newData); 12 13 /** Sets the data in the children of the current node, 14 creating them if they do not exist. 15 @param responseForNo The new data object for the left child. 16 @param responseForYes The new data object for the right child. */ 17 public void setResponses(T responseForNo, T responseForYes); 18 19 /** Sees whether the current node contains an answer. 20 @return True if the current node is a leaf, or 21 false if it is a nonleaf. */ 22 public boolean isAnswer(); 23 24 /** Sets the current node to its left child. 25 If the child does not exist, sets the current node to null. */ 26 public void advanceToNo(); 27 28 /** Sets the current node to its right child. 29 If the child does not exist, sets the current node to null. */ 30 public void advanceToYes(); 31 32 /** Sets the current node to the root of the tree.*/ 33 public void resetCurrentNode(); 34 } // end DecisionTreeInterface
With this tree, the program asks the question in the root and makes one of two guesses, depending on the answer to the question. Here is one possible exchange between the program and the user (user replies are bold): Is it in North America?
> yes My guess is U.S.A. Am I right? > yes I win. Play again? The program has guessed correctly; the tree remains unchanged.
Augmenting the tree in the guessing game. Suppose the user is thinking of something else. The exchange might go like this: Is it in North America? > no My guess is Brazil. Am I right? > no I give up; what are you thinking of? > England Give me a question whose answer is yes for England and no for Brazil. > Is it in Europe? Play again?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started