Skip to content

About

Darwin World Simulation developed using Java and the JavaFX framework

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

28 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Darwin World – Evolution Simulation

Darwin World is an object-oriented simulation of evolution inspired by Land of Lisp and Genetic Algorithms and Their Applications.
The project visualizes how populations of animals evolve over time in a dynamically changing environment.


Project Goal

The goal of this project is to create a simulation world where:

  • Animals move around a 2D map,
  • Search for food,
  • Consume plants to survive,
  • Reproduce and pass on genes,
  • Mutate over generations,
  • And eventually evolve into different species.

The simulation runs automatically and visualizes the process of natural selection over thousands of generations.


World Description

The world is a rectangular grid of square fields:

  • Most of the map is steppe (normal plant growth).
  • Some fields become fertile areas where plants grow faster based on animal activity.

Animals are herbivores and rely on plants as their only energy source.


Animal Anatomy

Each animal is defined by:

  • Position (x, y) – location on the map
  • Energy – decreases daily, increases after eating plants
  • Orientation – one of 8 possible directions
  • Genes – sequence of numbers (0–7) determining movement behavior

If an animal’s energy reaches 0, it dies.


Eating and Reproduction

Eating

When an animal stands on a field with a plant:

  • The plant is consumed
  • The animal gains a predefined amount of energy

Reproduction

Two animals on the same field may reproduce if they have enough energy:

  • Parents transfer part of their energy to the child
  • The child receives a mixed genotype from both parents
  • Random mutations are applied

Daily Simulation Cycle

Each simulation day consists of:

  1. Removing dead animals
  2. Turning and moving all animals
  3. Animals eating plants on their fields
  4. Reproduction of strong animals on the same field
  5. Growing new plants
  6. Updating soil fertility

Implemented Variants

Map Topology – Globe (Earth)

  • Left and right edges wrap around
  • Top and bottom edges are poles:
    • Animals cannot move beyond them
    • Attempting to do so reverses their direction (180°)

Plant Growth – Cultivated Soil System

Instead of a static jungle, fertile areas are created dynamically.

Cultivation

  • When a strong animal (energy ≥ minCultivateEnergy) steps on a field:
    • The field's visit counter increases

Fertility

  • After reaching cultivateLimit visits:
    • The field becomes fertile for fertileDays

Plant Growth Probability

  • 80% chance on fertile fields
  • 20% chance on normal steppe fields

Decay

  • Fertility decreases over time if not cultivated again

Mutation System – Full Randomness

During reproduction:

  • A random number of genes are selected
  • Each selected gene is replaced with a random value from 0 to 7

Technologies Used

  • Language: Java 25
  • Build Tool: Gradle
  • GUI: JavaFX
  • Testing: JUnit 5

How to Run

  1. Clone the repository
  2. Make sure Java 25 is installed
  3. Build and run using Gradle:
./gradlew run

preview

configuration

simulation1

simulation2

About

Darwin World Simulation developed using Java and the JavaFX framework

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages