====== The ArchEvo Model ====== **The ArchEvo Model** is a generalized description of how ArchEvo works. It abstracts away information about the [[ projects:archevo:ISA ]], [[ projects:archevo:CombatHandler | how combat is handled ]], and [[ projects:archevo:ReproductionHandler | how reproduction is handled ]]. ===== Cells ===== A cell is a virtual machine that exists in the Universe. ==== Registers ==== A cell has eight registers, each of which are eight bits wide. The first cell represent the amount of energy the cell has (( Since the registers are only 8 bits wide, that means that the maximum amount of energy a cell can have is limited to 256, as it cannot overflow )). When a new cell is created, all of the registers are set to 0, except for the energy register. Technically, the rest of the cells have no intrinsic meaning separate from the context in which they are run (including ISA, combat handler, reproduction handler, etc) , but generally the cells are given these names: * 0: Energy * 1: Logo * 2: Guess * 3: Register A * 4: Register B * 5: Register C * 6: Register D * 7: IPLOC The names of regs 1 and 2 come from the [[ projects:archevo:CaptureTheFlag ]] combat handler, and reg 7 is IPLOC in [[ projects:archevo:ASIA ]]. === Death === When energy is 0 (it can't underflow), the cell is dead, and will be garbage collected in the next iteration. ==== Program ==== A cell has a set of instructions that is called a Program. Each individual instruction is simply a set of bits. The instructions may be of an arbitrary length depending on the ISA. [[ projects:archevo:ASIA ]]'s instructions are eleven bits long. When a new cell is introduced randomly into the Universe, all of the bits of the program will be randomized. However, when a cell is created as a child of another cell, the new cell inherits the parent's program, with some mutated bits. A cell also has an Instruction Pointer (IP) . This is a number that is between 0 and the length of the program. When a cell is created this is initialized to 0. ==== Actions ==== Each iteration, the instruction that is pointed at by the IP is translated into an action. The possible actions are: * RegisterUpdate : Changes the value of a register. * Attack : Attacks the cell at the given offset. * DoNothing ((DoNothing has a counterpart ExternalDoNothing that exists for technical reasons)) * Move : Moves the cell to the offset. * MoveInstructionPointer : Moves the Instruction Pointer (Jumps) to a new location in the program * Reproduce : Creates a new cell at the offset. This action is then executed. === Reproduction === {{ :projects:archevo:executereproduction.png?100|}}When the reproduce action is triggered, a new baby cell may be created. However, first the [[ projects:archevo:ReproductionHandler]] is. The ReproductionHandler decides three things: * Can the parent reproduce? * What energy cost will the parent need to pay to reproduce? * What will the baby cell's initial energy be? If the parent cannot reproduce, no change will occur. If the parent can reproduce, then the energy cost is deducted from the parent, and a new cell is created with the proper amount of initial energy. (Click the flowchart on the right to enlarge it) === Attacking === {{:projects:archevo:combatflowchart.png?100 |}}Attacking other cells is the only way for a cell to gain more energy. The change in energy for both attacker and (if there is one ((Cells can also attack thin air, although this generally results in a penalty.))) defender are determined by the [[ projects:archevo:CombatHandler ]]. ===== Universe ===== The Universe is a grid that contains Cells. Although it is a finite grid, the edges wrap around to the opposite side, meaning that Cells can travel in one direction infinitely. Each iteration, some new cells are spawned with randomized programs.