



#include <string>
#include <iostream>

class BinaryDecisionTree {
public:
    std::string question;
    BinaryDecisionTree *left;
    BinaryDecisionTree *right;
};

BinaryDecisionTree* ask(BinaryDecisionTree *current)
{
    std::string answer;
    std::cout << current->question << std::endl;
    std::cout << "[yes / no]" << std::endl;
    while (true) {
        std::cin >> answer;
        if (answer == "yes") {
            return current->left;
        } else if (answer == "no") {
            return current->right;
        } else {
            std::cout << "yes or no!" << std::endl;
        }
    }
}

BinaryDecisionTree* read_file(char *path)
{
    /* You can use JSON, XML, etc. or roll your own.
     * A custom file format might look something like the following:
     * Is foo?
     *     Is bar?
     *         Is bin?
     *         Is foopadoop?
     *     Is baz?
     * Is qux?
     */
}

int main(int argc, char **args)
{
    if (argc != 2) {
        std::cout << "Must specify file!" << std::endl;
        return -1;
    }
    BinaryDecisionTree *curr = read_file(args[1]);
    while (true) {
        // After these lines, curr will point at the current node,
        // and prev will point at the previous node (the parent of curr).
        BinaryDecisionTree *prev = curr;
        curr = ask(curr);
    }
}

