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:
- 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
- On Linux you may need to add
-Dprism.forceGPU=true
JVM option to improve GUI performance
- 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 bySimulationEngine
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
-
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