| nop |
This is a no-operation. It has no effect. The operand is used as a jmp* label. |
| add |
Pops one element from the stack pushes stack-top + operand. If stack is empty, this pushes the operand. |
| mult |
Pops one element from the stack pushes stack-top * operand. If stack is empty, this pushes 0. |
| lt |
Pops A, and then B from the stack and pushes B<A. If there are less than 2 elements on the stack, the stack is emptied, and this pushes 0. The operand is ignored. |
| gte |
Pops A, and then B from the stack and pushes B>=A. If there are less than 2 elements on the stack, the stack is emptied, and this pushes 0. The operand is ignored. |
| ifDo |
Pops stack-top, if false, then the executionPtr jumps forward to the next nop with the same operand. If true, execution continues at the next instruction. |
| ifNotDo |
Pops stack-top, if true, then the executionPtr jumps forward to the next nop with the same operand. If false, execution continues at the next instruction. |
| push |
Pushes the operand to the stack. |
| pop |
Pops a number of elements from the stack as identified by operand. |
| dupTop |
Pushes a copy of stack-top onto the stack. Has no effect if the stack is empty. The operand is ignored. |
| pushM |
Pushes the value located in short-term-memory[operand] to the stack. If there is no value in the requested location, it pushes 0. |
| popM |
Pops a value from the stack to short-term-memory[operand]. If the stack is empty, 0 is written to this location. |
| jmpF |
Jumps the execution pointer to the next nop with the same operand. The search looks forward, and wraps around. If the requested label is not found, this is equivalent to a nop. |
| jmpB |
Jumps the execution pointer to the previous nop with the same operand. The search looks backward, and wraps around. If the requested label is not found, this is equivalent to a nop. |
| copy |
Copies from the read pointer in main memory to the write pointer in main memory. This copy has a 1/1000 chance to fail. If it fails it will be in one of three ways.
- Element does not get written. In this case the write pointer is decremented.
- Element is replaced with a random mutation.
- Element is written, and a random mutation is inserted after. In this case the write pointer is incremented.
If either the read or write pointers point outside of allocated memory, then the animal is considered disfunctional and is killed.
|
| incCounter |
Increment counter[operand]. If counter[operand] does not already exist, then counter[operand] is set to 1. |
| resetCounter |
Set counter[operand] to 0. |
| pushCounter |
Push counter[operand] to the stack. If counter[operand] does not exist, then 0 is pushed. |
| pushMemSize |
Pushes the current length of main memory to the stack. |
| pushCpuTime |
Pushes the current cputime to the stack. |
| pushReadPtr |
Pushes the current read pointer to the stack. |
| jmpReadPtrB |
Jumps the read pointer. Please see jmpB for more detail |
| jmpReadPtrF |
Jumps the read pointer. Please see jmpF for more detail |
| incReadPtr |
Increments the read pointer. This does not wrap, so may point into unallocated memory. |
| pushWritePtr |
Pushes the current write pointer to the stack. |
| jmpWritePtrB |
Jumps the write pointer. Please see jmpB for more detail |
| jmpWritePtrF |
Jumps the read pointer. Please see jmpF for more detail |
| incWritePtr |
Increments the write pointer. This does not wrap, so may point into unallocated memory. |
| runThread |
Starts a new thread running with the execution pointer set to this threads readPointer. All other thread state is set to default. |
| alloc |
Attempts to allocate memory at the end of this animal. The amount of space requested is popped from the stack.
The allocation only occurs if the animal has enough cputime to afford this allocation. Allocation costs 5*request_size.
The boolean result of allocation is pushed to the stack.
If the stack is empty, then no memory is allocated, and true is pushed on the stack. |
| divideProcess |
Attempts to birth a child. The attempt will succeed if there is space directly in front of the parent.
The boolean result of allocation is pushed to the stack.
The child is facing the same direction as the parent.
The child's main memory is initialised to everything between the read pointer and the write pointer. This memory is removed from the parent |
| look |
Looks forward and puts false on stack if no animal is seen within the horizon (10 spaces).
If an animal is seen, [otherProcess.memoryLength, otherProcess.cputime, distance to other process] are pushed to the stack. |
| turnR |
Changes the direction the animal is facing. |
| turnL |
Changes the direction the animal is facing. |
| move |
Moves forward one space. |
| sleep |
Sleeps for [operand] loops. |
| setSpeed |
Sets the threads execution speed.
A thread may be set to run at a higher clock speed, this allows the thread to execute arbitrarily many instructions in a single period.
The cost of executing each instruction is speed2, for a thread running at the default speed, this is 1. |