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.


Messages - MT DNA

Pages: [1]
1
DNA - General / Problem with Inline Conditions
« on: September 10, 2009, 03:23:32 AM »
Quote from: Shasta
Quote from: MT DNA
Cond must be true for any of the DNA from start to stop to execute.
This is not quite true, conditionals will always be evaluated, regardless of the boolean stack. This is what I would do to achieve the same result:
Code: [Select]
start
    *.nrg 500 >
        10
    *.nrg 1000 >
        20
    *.nrg 4000 >
        30
    *.nrg 8000 >
        40
    true
    .repro store
stop

No the problem is whether or not the conditions are true the values get pushed onto the stack, I think maybe, I'm just going to go with something like

*.nrg 500 >
     *.nrg 5000 ceil 100 div

2
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]