Skip to content

mariamhmostafa/Flower-Evolution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 

Repository files navigation

🌸 Flower Evolution

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.


🎮 Demo

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

🧬 Evolution Mechanics

  • 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]

🖼️ GUI Preview

Screenshot 2025-08-07 at 9 04 17 PM Screenshot 2025-08-07 at 9 04 24 PM Screenshot 2025-08-07 at 9 04 34 PM Screenshot 2025-08-07 at 9 04 45 PM Screenshot 2025-08-07 at 9 04 50 PM

🛠️ Technologies Used

  • Python 3
  • Tkinter for GUI rendering
  • Math & Random for DNA generation and simulation

🚀 How to Run

  1. Clone the repo
  git clone https://github.com/mariamhmostafa/Flower-Evolution.git
  cd Flower-Evolution
  1. Run the app Make sure Python 3 is installed. Then run:
python3 Flower-Evolution.py

🎯 Controls

Move your mouse over flowers to increase their fitness

Click "Next Generation" to evolve the next population

🧪 Sample DNA Example

[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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages