Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - MT DNA

Pages: [1]
1
DNA - General / Problem with Inline Conditions
« on: September 09, 2009, 02:15:07 AM »
Here is my code, I have removed everything that doesn't actually pertain to my question to make it more simple to read.
Code: [Select]
cond
 true
 'Condition for reproduction
start
  *.nrg 500 > mult 10 dropbool
  *.nrg 1000 > mult 20 dropbool
  *.nrg 4000 > mult 30 dropbool
  *.nrg 8000 > mult 40 dropbool
  .repro store
  .preg inc
stop

Ok now to confirm how I thought it worked. Correct me when I'm wrong (because I must be, 'cause my codes not working)

Cond must be true for any of the DNA from start to stop to execute.
nrg > 500 (true) add 10 to the stack (either way) drop the previous value from the bool stack putting it back to true.
nrg > 500 (true) add 20 to the stack (either way) drop the previous value from the bool stack putting it back to true.
nrg > 500 (true) add 30 to the stack (either way) drop the previous value from the bool stack putting it back to true.
nrg > 500 (true) add 40 to the stack (either way) drop the previous value from the bool stack putting it back to true.
(implied to be true) .repro store .preg inc

The way I've interpreted this is, that my values should only be added to the number stack if true is on the top of the bool stack, but I'm guessing I'm wrong on that. Obviously number have to be able to get on the stack in order for 2 1 > to be evaluated when false is on the stack. However, if thats the case how do I do this and make it right with only one store. I've been trying to keep my code a small and efficient as possible.

Thanks MT

Pages: [1]