Decision Tree Example

Hi,

I’m newbie to CoronaSDK and programming world. I’m trying to create a simple decision tree for my official job. Is there anybody who have a decision tree example for coronaSDK?

Thanks a lot!

Hello,

A decision tree is build with a few programming instructions. For example to decide if you go the left or right leaf you do a “if”.

If you want to make it easily. Create a table with all data (leaf and branch…)(it will be easy to edit the tree and it can be save in a json file) for example : 

tree={} tree[id of the object]={} tree[id].typeOfLeaf="condition"//example for condition tree[id].data1=idOfLeafIfTrue tree[id].data2=IDOfTheLeafIfFalse tree[id].condition1="valueName" tree[id].operator="\>" tree[id].condition2="SecondValueName" tree[id].nameOfTheLeaf="My Leaf" tree[id2]={} tree[id2].typeOfLeaf="RunTwoBranchAtTheSameTime" tree[id2].branch1=id1 tree[id2].branch2=id2

Then you will have a function who will read a tree part

function ReadABranch(id){ if(tree[id].typeOfLeaf=="Condition")then conditionAnalyse(id) else if.... }

I’m not sure how beginner-friendly it is, but I saw this pop up a couple weeks ago: erogodic

Hello,

A decision tree is build with a few programming instructions. For example to decide if you go the left or right leaf you do a “if”.

If you want to make it easily. Create a table with all data (leaf and branch…)(it will be easy to edit the tree and it can be save in a json file) for example : 

tree={} tree[id of the object]={} tree[id].typeOfLeaf="condition"//example for condition tree[id].data1=idOfLeafIfTrue tree[id].data2=IDOfTheLeafIfFalse tree[id].condition1="valueName" tree[id].operator="\>" tree[id].condition2="SecondValueName" tree[id].nameOfTheLeaf="My Leaf" tree[id2]={} tree[id2].typeOfLeaf="RunTwoBranchAtTheSameTime" tree[id2].branch1=id1 tree[id2].branch2=id2

Then you will have a function who will read a tree part

function ReadABranch(id){ if(tree[id].typeOfLeaf=="Condition")then conditionAnalyse(id) else if.... }

I’m not sure how beginner-friendly it is, but I saw this pop up a couple weeks ago: erogodic