The ArchEvo Model
The ArchEvo Model is a generalized description of how ArchEvo works. It abstracts away information about the ISA, how combat is handled , and 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 1). 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 CaptureTheFlag combat handler, and reg 7 is IPLOC in 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. 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 <register> <value>: Changes the value of a register.
- Attack <x_off> <y_off>: Attacks the cell at the given offset.
- DoNothing 2)
- Move <x_off> <y_off>: Moves the cell to the offset.
- MoveInstructionPointer <new_instruction_pointer>: Moves the Instruction Pointer (Jumps) to a new location in the program
- Reproduce <x_off> <y_off>: Creates a new cell at the offset.
This action is then executed.
Reproduction
When the reproduce action is triggered, a new baby cell may be created. However, first the 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
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 3)) defender are determined by the 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.