You should approach this from a data-directed angle. If you have a tree like the following, how would you write a function that read out the questions and took the right branch based on the answer?
- Code: Select all
("Are you breathing?" ("Are you bleeding?" "You have a cut."
Or you might choose a different data representation based on what you like. This is just to illustrate that if you put the data in the right format for your problem, the program will practically write itself.