Difference between revisions of "Execution Flag"

From WikiManual
Jump to: navigation, search
 
m (fmt)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= Overview =
+
In order to destructure the DNA language (so mutations can likewise be destructured), the way in which genes work had to be redone.
  
Details are a bit sketchy at the moment since I don't have the source code with meMost of this is from memory, so its factual validity may be questionable.
+
== The code that does it all (Visual Basic) ==
 +
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 programI modified it a bit to make it more readable.
  
In order to destructure the DNA language (so mutations can likewise be destructured), the way in which genes work had to be redone.
+
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 Conditions Flag =
+
The [[store]] commands will only operate if CurrentFlow is set to something other than CLEAR.
  
= The Executon Flag =
+
I don't remember what the default values are for CurrentFlow and CurrentCondFlag.
Set to either: [[start]], [[else]], or NULL.  The [[store | stor]]age commands only work if the execution flag is set to start or else.
 
  
Upon encountering a [[stop]] command, the execution flag is cleared.
+
==How the DNA works==
 +
* [[Genes]]
 +
* [[Execution Flag]]
 +
* The [[Stack]]  
 +
* [[Custom labels]] (or variables if you prefer)

Latest revision as of 15:16, 7 January 2006

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 (Visual Basic)

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