A visual genetic algorithm simulation using Python and Tkinter, where a population of flowers evolves over time based on color, petal count, and size. The user can influence evolution by hovering over flowers to increase their fitness.
Each flower is made up of a unique DNA sequence controlling:
- 🌼 Center size and color
- 🌸 Petal color and number
- 🌿 Stem rendering
You can:
- Hover over flowers to increase their fitness
- Click "Next Generation" to evolve flowers using:
- Selection
- Crossover
- Mutation
- Fitness is influenced by user interaction (hovering)
- Selection chooses the top 4 fittest flowers
- Crossover combines DNA of two parents to create new children
- Mutation randomly alters parts of the DNA based on a small rate
- DNA structure: [center_size, center_r, center_g, center_b, petal_r, petal_g, petal_b, petal_count]
- Python 3
- Tkinter for GUI rendering
- Math & Random for DNA generation and simulation
- Clone the repo
git clone https://github.com/mariamhmostafa/Flower-Evolution.git cd Flower-Evolution
- Run the app Make sure Python 3 is installed. Then run:
python3 Flower-Evolution.py
Move your mouse over flowers to increase their fitness
Click "Next Generation" to evolve the next population
[10, 255, 100, 80, 200, 90, 60, 5] Center size = 10 Center color = RGB(255,100,80) Petal color = RGB(200,90,60) Petal count = 5