
Find Dialog

The find dialog can be accessed by the Edit >> Find menu item, or pressing Ctrl+F.
Use this dialog if you want to search for organisms with certain properties. You enter a search expression using KFORTH notation. The matching organisms will be tagged using the radioactive tracer feature.
Examples
MAX-ENERGY ENERGY = |
Find all organisms that have the maximum energy.
AGE 100 >= NCHILDREN 1 = and |
Find organisms that are at least 100 steps old, and have 1 living children
NUM-CB 45 = NUM-DEAD 1 >= and |
Find organisms that have a kforth program consiting of 45 code blocks, and have 1 or more dead cells.
NUM-CELLS 20 >= NUM-CELLS 25 <= and |
Find organisms with between 20 and 25 cells.
parent1 parent2 <> |
Find organisms that were created sexually.
Click on [INSTRUCTIONS] to see the available kforth instructions for this mode. (only the find related instructions are shown).
The results of the find operation are shown using Radioactive Tracers. A find expression of "0" or blank will clear all tracers.
NOTE: Syntax errors will be checked for. However another kind of error is one in which the number of items on the data stack is not 1. In this case the expression is treated as FALSE. (For example the expression, "AGE AGE" leaves two values on the stack, and so always is treated as FALSE).
The strain population dialog will show the number of organisms with radioactive tracers.
Minimum, Maximum, Average Instructions
There are a couple KFORTH instructions that are computed by examining all organisms. These are the MIN, MAX and AVG instructions.
The MIN / MAX / AVG instructions return values that get computed based on the overall simulation. So MAX-ENERGY would be the maximum energy value for all organisms in the current simulation. AVG-ENERGY is the average energy value for all organisms. MIN-ENERGY would the smallest energy value found after examining all organisms. THese MIN/MAX/AVG constants can be used to search for the organism with the most or least value. (Click on the [Instructions] button to see the full list).
Find Instruction Reference
INSTRUCTION | USAGE | DESCRIPTION |
ID | ( -- id) | The organism ID. Because organism ID's are large integers, and KFORTH can only handle 16-bit numbers, the organism ID is
modulos 10,000. Example: an organism id of 10,062,527 becomes 2527 with this instruction. |
PARENT1 | ( -- parent1) | The parent1 ID. Because organism ID's are large integers, and KFORTH can only handle 16-bit numbers, the organism ID is
modulos 10,000. Example: a parent id 1 of 10,062,527 becomes 2527 with this instruction. |
PARENT2 | ( -- parent2) | The parent2 ID. Because organism ID's are large integers, and KFORTH can only handle 16-bit numbers, the organism ID is
modulous 10,000. Example: a parent id 2 of 10,062,527 becomes 2527 with this instruction. |
STRAIN | ( -- strain) | The strain number. A number between 0 and 7. |
ENERGY | ( -- e) | The energy of the organism. If the energy is more than 32,767 then this instruction returns 32,767. |
GENERATION | ( -- g) | The generation. If the generation is more than 32,767 then this instruction returns 32,767. |
NUM-CELLS | ( -- n) | The number of cells that the organism consists of. |
AGE | ( -- n) | The age of the organism dividied by 1000. If this is more than 32,767 then this instruction returns 32,767. |
NCHILDREN | ( -- n) | The number of living children. We scan the simulation and count the number of organisms that have this organism as its parent1 or parent2. |
EXECUTING | (cb -- bool) | Does organism have a cell currently executing inside code block 'cb'? Returns 1 or 0. |
NUM-CB | ( -- n) | The total number of code blocks the organism has. |
NUM-DEAD | ( -- n) | The number of cells that have just died (colored red). |
MAX-ENERGY | ( -- e) | Constant: for all organisms return the MAXIMUM energy amount. |
MIN-ENERGY | ( -- e) | Constant: for all organisms return the MINIMUM energy amount. |
AVG-ENERGY | ( -- e) | Constant: for all organisms return the AVERAGE energy amount |
MAX-AGE | ( -- n) | Constant: for all organisms return the MAXIMUM age (divided by 1,000). |
MIN-AGE | ( -- n) | Constant: for all organisms return the MINIMUM age (divided by 1,000). |
AVG-AGE | ( -- n) | Constant: for all organisms return the AVERAGE age (divided by 1,000). |
MAX-NUM-CELLS | ( -- n) | Constant: for all organisms return the MAXIMUM number of cells an organism has. |