Execute a string
in
Programming Questions
•
2 years ago
Hi,
I am developing a GA system. I have a DNA which has nodes like
<dna>
<operator>+</operator>
<child1>
<operator>sin</operator>
<child1>
<value>x</value>
</child1>
</child1>
<child2>
<operator>cos</operator>
<child1>
<value>y</value>
</child1>
</child2>
</dna>
which is parsed to "sin(x)+cos(y)"
a DNA can be very complex
I have to use this function to find all possible pixels in an image.
So that I need to execute the command;
longest solution which I do not want to do is using switches and calculate every node.
I could not find an execute command for Processing.
I thought about using javascript in Processing so that I can run this string with eval but I could not manage to do it.
What do you suggest ?
1