Block-based Evolving Game
Arrow-based automation game (this sounds like the title of a patent)
Basic Blocks
Basic blocks can be one of many colors, and have arrows pointing in one of the four directions. All adjacent blocks of the same color connect and act as a group.
Movement
The basic action a group will perform in each step of the simulation is for the entire group to move as one.
Possible Methods
Vector addition: To determine which direction to move, the vectors describing each of the arrows are summed, and the group moves in the direction defined by the greatest dimension of the resultant vector.
Voting: Within a group, the number of blocks pointing in each direction is summed. Then, the direction receiving the most votes is the direction that the group moves. Any direction that would move the group off the playing field is disqualified.
(Both methods are capable of producing ties. In the event of a tie, one tie-breaking method could be to randomize the choice among the winning directions.)
Attack
If a group's movement is blocked (any of the individuals are blocked), energy is stolen from the blocking group wherever the first group has arrows pointing at the blocking group.
Energy
Each block has an energy store, a value between 0 and 50 (or something). A block with 0 energy dies (leaving an empty cell), and a block with more than 25 energy will give energy to neighboring blocks in the same group. Every time a block successfully moves, it loses one energy.
Special Blocks
Special blocks will be rare, making less than 10% of your supply, but will be necessary for more advanced behavior.
Flipper
An arrow which reverses direction when the group is blocked. Both horizontal and vertical flippers exist.
Rotator
An arrow which rotates its direction when the group is blocked. There is a clockwise rotator and a counter-clockwise rotator. (Note, it would be possible to build a flipper with two of these, so the flipper may be unnecessary)
Retreat Block
This block has an arrow, but the arrow is normally dim and does not participate in the voting process. When a block in the group has low energy, the arrow activates.
Energy Push Block
This block will inject energy into a group it collides with if its arrow is pointing at that group.
Aggressive Block
This block will point toward any opponent's group upon collision.
Cowardly Block
This block will point away from any opponent's group upon collision.
Friendly Block
This block will point toward any group of the same side upon collision.
Rude Block
This block will point away from any group of the same side upon collision.
Update Rule
Performing an iteration is fairly complicated. It involves these steps:
- Determine the direction each group is moving.
- Check if each group conflicts with the initial position of any group that is not moving in the same direction. If it is, it's blocked, and the blocks which conflict will steal energy as appropriate.
- If the group does not have an initial conflict, mark the locations for each group that the blocks will ideally move to (which is their initial location if the group is already blocked). Any location with two or more blocks marked is a conflict, and all relevant groups are blocked from moving. If the blocks in question point towards the cell with the conflict, energy is stolen.
- If any conflicts were found in this iteration, redo the previous step.
- Perform the update.