{"id":23383368,"url":"https://github.com/blagojeblagojevic/ecosystem","last_synced_at":"2025-09-14T18:52:20.636Z","repository":{"id":203107231,"uuid":"708477554","full_name":"BlagojeBlagojevic/Ecosystem","owner":"BlagojeBlagojevic","description":"This C program simulates an evolutionary ecosystem using SDL2 graphics library","archived":false,"fork":false,"pushed_at":"2024-02-08T16:42:35.000Z","size":1631,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-14T06:36:42.763Z","etag":null,"topics":["c","genetic-algorithm","sdl2"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BlagojeBlagojevic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-22T17:17:35.000Z","updated_at":"2023-11-03T09:26:20.000Z","dependencies_parsed_at":"2024-02-08T17:46:57.029Z","dependency_job_id":null,"html_url":"https://github.com/BlagojeBlagojevic/Ecosystem","commit_stats":null,"previous_names":["blagojeblagojevic/ecosystem"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlagojeBlagojevic%2FEcosystem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlagojeBlagojevic%2FEcosystem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlagojeBlagojevic%2FEcosystem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlagojeBlagojevic%2FEcosystem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlagojeBlagojevic","download_url":"https://codeload.github.com/BlagojeBlagojevic/Ecosystem/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247816838,"owners_count":21001049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","genetic-algorithm","sdl2"],"created_at":"2024-12-21T22:20:17.337Z","updated_at":"2025-04-08T09:44:58.996Z","avatar_url":"https://github.com/BlagojeBlagojevic.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Evolutionary Simulation with SDL2\n\nThis C program simulates an evolutionary ecosystem using SDL2 graphics library. Prey creatures move and reproduce based on their genetic traits. Over time, the population evolves as individuals with advantageous traits survive and reproduce. The simulation shows the evolution of prey creatures with different genetic characteristics (speed, energy, reproduction speed) and colors (white, red, green, blue, yellow) in a dynamic environment. \n\n## Requirements\n\n* SDL2 library installed on your system.\n\n## How to Build and Run\n1. Make sure you have SDL2 installed. You can download it from SDL2 official website or install it using a package manager.\n2. Compile the program using a C compiler. For example, using gcc:\n\n\u003e gcc -o main main.c -lSDL2 -lm -fopenmp\n\nNote: The -fopenmp flag is used to enable OpenMP parallelization for better performance. Make sure your compiler supports OpenMP.\n\n## Simulation Rules\n\n* Prey creatures (colored squares) move around the environment.\n* Prey creatures gain and lose energy as they move.\n* Prey creatures can reproduce if their energy level is high enough.\n* Offspring inherit genetic traits from their parents with a chance of mutation.\n* The simulation runs for a specified number of rounds.\n\n##   Simulation Results\nAfter the simulation ends, the program outputs the average genetic traits of the population\nand the number of individuals with each color.\n\n## Parameters (in the code)\n\n* 'Nprey': Number of initial prey creatures.\n* 'Nfood': Number of food particles in the environment.\n* 'MutationChance': Chance of genetic mutation during reproduction.\n* 'Nround': Number of simulation rounds.\n\nFeel free to modify these parameters in the code to observe different evolutionary outcomes.\n\n\n\n\n\n\n\n\n\n\n\n![Screenshot_4](https://github.com/BlagojeBlagojevic/Ecosystem/assets/100707842/414b93e1-1eb6-4909-a8d0-1c61dcf645e1)\n![Screenshot_5](https://github.com/BlagojeBlagojevic/Ecosystem/assets/100707842/2f735b43-ca4d-4354-97ff-ba5cb012e885)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblagojeblagojevic%2Fecosystem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblagojeblagojevic%2Fecosystem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblagojeblagojevic%2Fecosystem/lists"}