31
DNA - General / Re: DNA language
« on: May 08, 2011, 04:58:36 PM »
Here is a quick example of how the boolean stack works. I put the action performed, and the state of the boolean stack one after another. The labels (A, B, C, etc.) are there to illustrate how some commands work, they are not truly there and have no effect. Note that this all happens while the DNA is being processed each cycle. These commands could all happen one after another in DNA and it would give the exact same result as I have written down here. Any command that does not operate on the boolean stack (store, add, shoot) will take place only if the top value on the boolean stack is true.
Code: [Select]
50 40 <
(1) False - A
50 40 >
(1) True - B
(2) False - A
50 40 =
(1) False - C
(2) True - B
(3) False - A
overbool
(1) True - B'
(2) False - C
(3) True - B
(4) False - A
and
(1) False - (B' and C)
(2) True - B
(3) False - A
dupbool
(1) False - (B' and C)
(2) False - (B' and C)
(3) True - B
(4) False - A
not
(1) True - (not (B' and C))
(2) False - (B' and C)
(3) True - B
(4) False - A
or
(1) True - ((B' and C) or (not (B' and C))
(2) True - B
(3) False - A
swapbool
(1) True - B
(2) True - ((B' and C) or (not (B' and C))
(3) False - A
dropbool
(1) True - ((B' and C) or (not (B' and C))
(2) False - A
true
(1) True - D
(2) True - ((B' and C) or (not (B' and C))
(3) False - A
clearbool
(empty)