Skip to content

Instantly share code, notes, and snippets.

@patricksimpson
Last active February 13, 2019 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patricksimpson/720c772402f4b7e13e07a37f541b465a to your computer and use it in GitHub Desktop.
Save patricksimpson/720c772402f4b7e13e07a37f541b465a to your computer and use it in GitHub Desktop.
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