Skip to content

danilop/simul-evo

Repository files navigation

Simul-Evo

A Rust-based evolution simulation project that visualizes and simulates evolutionary processes. Watch as digital organisms evolve and adapt their behavior through natural selection in a dynamic environment.

Description

Simul-Evo is an artificial life simulation that models evolutionary processes in a 2D environment. Each organism follows a set of instructions that determine its behavior, and these instructions can mutate and evolve over generations. Organisms must manage their energy, interact with their environment, and compete or cooperate with others to survive.

Features

  • Real-time visualization of evolutionary processes
  • Complex organism behavior through instruction-based programming
  • Environmental interactions including walls and messages
  • Energy-based survival mechanics
  • Mutation and reproduction systems
  • Configurable simulation parameters

Prerequisites

  • Rust (edition 2021)
  • Cargo (Rust's package manager)

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/simul-evo.git
    cd simul-evo
  2. Build the project:

    cargo build --release

Usage

Run the simulation:

cargo run --release

Organism Instructions

Organisms in the simulation can perform various actions through their instruction set. Here are the categories of available instructions:

Direction Modifiers

Direction modifiers affect the NEXT directional instruction:

  • Left, Right, Back - Change direction for next instruction
  • Rnd - Random direction for next instruction
  • Example: Left Move moves left, Rnd Turn turns to random direction

Movement Instructions

  • Still - Stay in place (gains energy)
  • Move - Move forward (or use direction modifier: Left Move)
  • Jump - Jump two cells forward (or use modifier)
  • Turn - Turn in direction (requires modifier: Right Turn)

Conditional Instructions (require EndIf)

  • IfEmpty, IfWall - Check adjacent cell (use Not to invert)
  • IfSimilar, IfIdentical - Compare with nearby organisms
  • IfSmaller, IfYounger, IfLessEnergy - Comparisons (use Not for bigger/older)
  • IfFlag, IfPosCounter, IfNegCounter - Agent state checks
  • Randomly, Often, Rarely, VeryRarely - Probability-based skips

Logic Modifier

  • Not - Inverts the next conditional (e.g., Not IfEmpty = if occupied)

Environment Interaction

  • DestroyWall, BuildWall - Wall manipulation (use direction modifier)
  • Defend, DefendX2 to DefendX5 - Defensive stance
  • Attack, Share, Push - Direct interaction with other agents
  • MsgBlue, MsgRed, MsgGreen - Leave colored messages
  • IfMsgBlue, IfMsgRed, IfMsgGreen - React to messages

Bonds (Multi-cell organisms)

  • Bond, Unbond - Create/break bonds with adjacent agents
  • IfBonded, IfAnyBond - Check bond state
  • ShareBonded, SpawnBonded - Coordinated actions

Program Flow Control

  • Restart - Return to start of program
  • Skip...Until - Loop construct
  • Tag, GoToTag, BackToTag - Program markers and jumps
  • EndIf, Else - Block terminators

Flags & Counters

  • FlagTrue, FlagFalse, FlagFlip - Internal flag state
  • IncCounter, DecCounter, ResetCounter - Counter operations
  • YellFlag, YellCounter - Copy state to adjacent agent

Each instruction consumes energy, and organisms must balance their actions with energy management to survive and reproduce.

Run with --help-instructions for complete instruction reference.

License

This project is licensed under the terms included in the LICENSE file.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

About

Simulating Evolution

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages