private void updateTree() { Console.Write("You win! What were you thinking of?"); string userObject = Console.ReadLine(); Console.Write("Please enter a question to distinguish a(n) " + this.message + " from " + userObject + ": "); string userQuestion = Console.ReadLine(); Console.Write("If you were thinking of a(n) " + userObject + ", what would the answer to that question be?"); char input = getYesOrNo(); //y or n if (input == 'y') { this.noNode = new BtNode(this.message); this.yesNode = new BtNode(userObject); } else { this.yesNode = new BtNode(this.message); this.noNode = new BtNode(userObject); } Console.Write("Thank you my knowledge has been increased"); this.setMessage(userQuestion); }
public BtTree(string question, string yesGuess, string noGuess) { rootNode = new BtNode(question); rootNode.setYesNode(new BtNode(yesGuess)); rootNode.setNoNode(new BtNode(noGuess)); }
public void setYesNode(BtNode node) { yesNode = node; }
/** * Constructor for the nodes: This class holds an String representing * an object if the noNode and yesNode are null and a question if the * yesNode and noNode point to a BTNode. */ public BtNode(string nodeMessage) { message = nodeMessage; noNode = null; yesNode = null; }
public void setNoNode(BtNode node) { noNode = node; }