Skip to content

An evolution simulator written in Java (simulation) and Kotlin (JavaFX GUI) as a part of an Object-Oriented Programming course at the AGH University of Science and Technology.

License

Notifications You must be signed in to change notification settings

congard/evolution-agh

Repository files navigation

Evolution

This project is developed by congard within the subject of Object Orientated Programming at the AGH University of Science and Technology.

Project description: apohllo/obiektowe-lab/proj1

Technology: Java 17 (simulation), Kotlin (JavaFX GUI)

Libraries used:

Hints

  • Use the mouse wheel (or touchpad) to zoom in/out the map
  • Right-click a cell to show its info (and the objects in it)
  • You can resize border panes with mouse
  • Some params can be changed during simulation
  • Pin the animal you want to observe
  • Cells pane: double-click an animal to see its info

Screenshots

StartScreen

WorldWidget

GenotypeStatsBorderPane

StatsBorderPane

CellsBorderPane

AnimalsBorderPane

WorldWidget_scale

Notes

  • On Linux you may need to add -Dprism.forceGPU=true JVM option to improve GUI performance

TODO

simulation

  • Params
    • Export to JSON
    • Import from JSON
  • Vector2d
  • WeightedRandom
  • Orientation
  • Gene
  • Genotype
    • static Genotype mix(Genotype left, Genotype right, float pos)
  • WorldCell
  • AbstractWorld
    • Statistics to CSV
    • synchronized void update()
      • Generate new grass
    • synchronized void forEachCell
    • elements: List<List<List<WorldAbstractElement>>>
    • deadAnimals: LinkedList<Animal>
    • aliveAnimals: HashSet<Animal>
    • synchronized void forEachAlive
    • synchronized void forEachDead
    • calcAvgLifespan() - for dead
    • aliveAnimalsCount
    • plantsCount
    • freeFieldsCount
    • avgEnergy - for alive
    • day - day number
    • long nextId()
    • void add(WorldAbstractElement)
    • void remove(WorldAbstractElement)
  • RoundWorld
  • PortalWorld
  • WorldElementType
  • WorldAbstractElement
    • pos: Vector2d
    • world: AbstractWorld
    • type: WorldElementType
    • void remove()
  • Plant
    • nutritionalValue: Float
  • Animal
    • eat(Plant)
    • isWellFed()
    • live() - must be called by SimulationEngine every 'day'
    • orientation: Orientation
    • children: LinkedList<Animal>
    • parents: Animal[2]
    • health: Float
    • birthday: Int - day number
    • deathday: Int - -1 if alive
    • eatenPlantsCount: Int
    • genotype: Genotype
    • id: long
    • boolean isAlive()
    • static Animal reproduce(Animal p1, Animal p2)
  • OnTickListener : one tick - one day
  • ErrorHandler
  • SimulationEngine
    • void start()
    • void pause()
    • void stop()
    • AbstractWorld getWorld()
  • Thread safety
    • Lists read/write

gui

  • StartScreen
    • use reflection for params
    • import params from json file
    • export params to json file
    • enable Scroll for fields
  • EvolutionWindow
    • Record button - record statistics to CSV
    • StatusBar
    • Update gui on onTick
  • WorldWidget
  • borders
    • StatsBorderPane
    • ParamsBorderPane
    • GenotypeStatsBorderPane
      • GenotypePane
    • CellsBorderPane
    • AnimalsBorderPane
  • CSS styles for Alert
  • Tests for math

Disclaimer: I ran out of time, so you might find the code a bit undocumented

About

An evolution simulator written in Java (simulation) and Kotlin (JavaFX GUI) as a part of an Object-Oriented Programming course at the AGH University of Science and Technology.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published