The a simulation that brings evolution to life. Observe rapid mutations and adaptations in a virtual petri dish where you control the speed, population type, size, and environment. Perfect for exploring genetic evolution, testing ideas, or simply marveling at life’s complexity—The Gen V turns evolution into an interactive experience.
simulation inspired by research from the OpenEvo Lab, a global open-source initiative dedicated to advancing evolutionary biology.
Welcome to The Gen V, a revolutionary project redefining how we explore evolution. In this groundbreaking simulated environment, a dynamic generation of simple organisms thrives within a virtual petri dish. These organisms, designed to evolve rapidly, allow us to observe mutations, adaptations, and population dynamics in real time.
With The Gen V, users gain unparalleled control over the evolutionary process. Tailor your simulation by adjusting parameters like mutation speed, population type, organism size, environmental conditions, and more. Introduce new components, observe survival strategies, and unlock insights into genetic evolution that would take millennia in nature—all in a fraction of the time.
Whether you're a scientist, educator, or enthusiast, $GENV offers an interactive and engaging platform for studying evolutionary biology, testing hypotheses, or simply marveling at the complexity of life. Step into The Gen V, where evolution accelerates and discovery knows no bounds.
import random
import matplotlib.pyplot as plt
from typing import List, Dict
# Simulation configuration
class Config:
population_size = 100
genome_length = 10
mutation_rate = 0.05
environment_factors = {"food": 0.5, "temperature": 0.3, "predators": 0.2}
max_generations = 50
mutation_types = ["point", "deletion", "insertion"]
log_interval = 5
# Define an organism
class Organism:
def init(self):
self.genome = [random.choice(["A", "T", "C", "G"]) for _ in range(Config.genome_length)]
self.fitness = 0
def mutate(self):
mutation = random.choice(Config.mutation_types)
if mutation == "point":
# Point mutation
idx = random.randint(0, len(self.genome) - 1)
self.genome[idx] = random.choice(["A", "T", "C", "G"])
elif mutation == "deletion" and len(self.genome) > 1:
# Deletion mutation
idx = random.randint(0, len(self.genome) - 1)
del self.genome[idx]
elif mutation == "insertion":
# Insertion mutation
idx = random.randint(0, len(self.genome))
self.genome.insert(idx, random.choice(["A", "T", "C", "G"]))
# Environment interactions and fitness calculations
class Environment:
def init(self, factors: Dict[str, float]):
self.factors = factors
def calculate_fitness(self, organism: Organism):
factor_influence = sum([random.random() * self.factors[key] for key in self.factors])
genome_stability = 1 / (1 + abs(len(organism.genome) - Config.genome_length))
return factor_influence * genome_stability
# Population lifecycle management
class Population:
def init(self):
self.organisms = [Organism() for _ in range(Config.population_size)]
def evolve(self, environment: Environment):
# Calculate fitness for all organisms
for organism in self.organisms:
organism.fitness = environment.calculate_fitness(organism)
# Select the fittest organisms for reproduction
self.organisms.sort(key=lambda x: x.fitness, reverse=True)
survivors = self.organisms[: Config.population_size // 2]
# Reproduce with mutations
offspring = []
for parent in survivors:
child = Organism()
child.genome = parent.genome[:]
child.mutate()
offspring.append(child)
# Update population
self.organisms = survivors + offspring
# Simulation with data logging and visualization
class Simulation:
def init(self, config: Config):
self.config = config
self.environment = Environment(config.environment_factors)
self.population = Population()
self.generation_data = []
def run(self):
for generation in range(self.config.max_generations):
self.population.evolve(self.environment)
avg_fitness = self._log_data(generation)
if generation % self.config.log_interval == 0 or generation == self.config.max_generations - 1:
print(f"Generation {generation + 1}: Avg Fitness = {avg_fitness:.3f}")
self._visualize_results()
def _log_data(self, generation: int):
avg_fitness = sum(o.fitness for o in self.population.organisms) / len(self.population.organisms)
genome_lengths = [len(o.genome) for o in self.population.organisms]
self.generation_data.append({"generation": generation, "avg_fitness": avg_fitness, "avg_genome_length": sum(genome_lengths) / len(genome_lengths)})
return avg_fitness
def _visualize_results(self):
generations = [data["generation"] for data in self.generation_data]
avg_fitness = [data["avg_fitness"] for data in self.generation_data]
avg_genome_length = [data["avg_genome_length"] for data in self.generation_data]