Difference between revisions of "Execution Flag"

From WikiManual
Jump to: navigation, search
(The code that does it all)
m (How the DNA works)
Line 29: Line 29:
 
* [[Genes]]
 
* [[Genes]]
 
* [[Execution Flag]]
 
* [[Execution Flag]]
* [[The Stack]]  
+
* The [[Stack]]  
 
* [[Custom labels]] (or variables if you prefer)
 
* [[Custom labels]] (or variables if you prefer)

Revision as of 15:28, 23 December 2005

Overview

In order to destructure the DNA language (so mutations can likewise be destructured), the way in which genes work had to be redone.

The code that does it all

Instead of trying to explain it all, which I'm sure I'd fail at, I'll just post the code that does it. This isn't exactly the same code that's in the program. I modified it a bit to make it more readable.

Select Case n
  Case 1 'cond
    CurrentFlow = COND
  Case 2, 3, 4 'assume a stop command, or it really is a stop command
    'this is supposed to come before case 2 and 3, since these commands
    'must be executed before start and else have a chance to go
    If CurrentFlow = COND Then CurrentCondFlag = AddupCond() 'ANDs all conditions
    CurrentFlow = CLEAR
    Select Case n
      Case 2 'start
        If CurrentCondFlag = NEXTBODY Then CurrentFlow = BODY
      Case 3 'else
        If CurrentCondFlag = NEXTELSE Then CurrentFlow = ELSEBODY
    End Select
End Select

The store commands will only operate if CurrentFlow is set to something other than CLEAR.

I don't remember what the default values are for CurrentFlow and CurrentCondFlag.

How the DNA works