Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Car Expert - Decision Tree
/*
* key: 'unqiue_key'
question: 'string',
responses: [{
response: 'positive',
answer: 'battery_terminal'
}],
*/
const carExpert = [{
key: 'start',
question: 'Is the car silent when you turn the key?',
responses: [
{
response: 'positive',
answer: 'battery_terminal'
},
{
response: 'negative',
answer: 'clicking_noise'
}
]
},
{
key: 'battery_terminal',
question: 'Are the battery terminals corroded?',
responses: [
{
response: 'positive',
answer: 'clean_terminals'
},
{
response: 'negative',
answer: 'replace_cables'
}
]
},
{
key: 'clicking_noise',
question: 'Does the car make a clicking noise?',
responses: [
{
response: 'positive',
answer: 'replace_battery'
},
{
response: 'negative',
answer: 'crank_fail'
}
]
}
...
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.