Stack
Contents
Overview
The principle is quite simple: values are placed in a temporary holding area that is first-in-last-out (FILO): like a stack of dishes. Almost all language commands make use of some stack or other, taking values off the stack and manipulating them, even occassionaly putting new values back on.
An example to illustrate: Subtraction
a - b = c
Say you want to calculate c. In the end we'll want c to be on the top of the stack so we can use it again.
With the stack, you must first place the two operands on. Now, this is very important: Darwinbots uses reverse-Polish notation. Which means that in general the second number on the stack will be the first number used in the calculation. This may seem complicated, but it means that the DNA is easier to read in a way we're accustomed to. Anyway, here's what it'll look like:
a b '(note that if this were real code, you'd be more likely to see 5 6, or *.in1 *.in2
Next we'll want to invoke the subtraction command sub. which we simply do by having it in the DNA.
a b sub
That's it. Sub will take a and b from the stack, subtract b from a, and place the new answer on the top of the stack. In essence, we're basically just moving the sub command from the middle of the two numbers to the end.
asses shemale clip big ass ass teen gay anal butts nice ass ass parade butts teen anal ass and pussy totally spies hentai ass fuck anal fisting black ass teen ass ass black ass big black ass anime girls anal fisting ass licking anal teen ass like that ass fuck ass teen ass teen big butts nice butt black shemale tight ass sexy ass big ass black booty big butts tranny girls perfect butt free shemale pics anal sex inuyasha hentai anal teen adult cartoons teen anal big tits round asses anal fucking final fantasy hentai teen ass hentai lesbian anal fucking transvestites hot ass tranny surprise onion booty anal booty teen anal anal ass licking onion booty transexuals anal tranny surprise butts cartoon sex ass licking manga girls hot anime girls anime porn anime babes inuyasha hentai disney hentai transvestite sex cartoons tranny surprise hentai galleries shemale hentai free hentai tranny sex manga sex ass and pussy cartoon sex big butt free hentai movies ass teen henti shemale cartoons sex comics sex comics sailor moon hentai big booty final fantasy hentai ass like that dbz hentai sailor moon hentai sex comics love hina hentai adult cartoons free shemale movies adult cartoons nice butt final fantasy hentai free shemale hentai lesbian tight ass final fantasy hentai anal sex anime sex anime hentai disney hentai anal fucking hentai galleries trannies anime porn free shemale pics disney hentai butt hot anime girls shemale galleries dbz hentai big ass
Where its used
A stack is used in the following bits of the progam:
- conditions - A seperate stack for conditions is kept for the logical operators to act on. At the end of every condition block in the DNA, all values remaining in this stack are and-ed together and the result saved in an execution flag.
- integers - basic, advanced, and bit commands, and any others I may have forgotten, use the integer stack, which is what is commonly ment by "the stack".
Technical Details
Empty
If a command tries to read from the stack when it's empty, it gets the appropriate default value. For the integer stack, this is 0. For the conditions stack, this is TRUE.
Full
In the same way that a pile of dishes can get too large, so can the stack. After the stack begins to hold 20 numbers, it will begin to push older numbers on the bottom off. This helps ensure that new DNA will always be operable even if it comes after sloppy DNA that doesn't clean up after itself and leaves a mess all over the kitchen floor, and won't pay their half of the rent, and stays in the bathroom too long...
Oh, right, Darwinbots.
It is easy to empty the stack by placing several add, sub, or mult commands in a row.
Number Range
As of 2.4, you are allowed to place numbers as large as +/-2000000000 (that's +/-2E9 or +/-2 billion) on the stack. Note that the bots' memory can only hold integers as large as +/- 32000. If a value greater in magnitude than this is stored in a memory location, your computer will explode. (Okay, not really. I think it's "mod"ed 32000. I'd have to check --Numsgil 11:06, 19 Sep 2005 (MST)).
At the end of the cycle
As of 2.4, after a bot finishes executing its DNA for the cycle, its stack is cleared. That means that a bot can't use the stack to store values between cycles. For that, you have to use memory.
How the DNA works
- Genes
- Execution Flag
- The Stack
- Custom labels (or variables if you prefer)