Cell evolution using a genetic algorithm
This project represents the evolution of cells, where each cell can eat others or reproduce using a genetic algorithm. Here's what came out in the end:
![](https://private-user-images.githubusercontent.com/89744777/270099872-041d733c-7d14-4799-a176-ac70a23310fa.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxOTA3MTMsIm5iZiI6MTcyNDE5MDQxMywicGF0aCI6Ii84OTc0NDc3Ny8yNzAwOTk4NzItMDQxZDczM2MtN2QxNC00Nzk5LWExNzYtYWM3MGEyMzMxMGZhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIwVDIxNDY1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThjYjkxMmNiMDExN2ZhNzU5NzBjZDk3OGYyYzlhYmJkOThkYWZkYmZhN2JlMTVmZmE0ZjZiNzYyM2YzNWViYTgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.sHutBz4jUQcCe-7Gapn3RSWBz2WHtAsIZOL7xvVUKsE)
![](https://private-user-images.githubusercontent.com/89744777/270154570-fff2d728-a91c-4d70-82bf-a7a8e75ad571.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxOTA3MTMsIm5iZiI6MTcyNDE5MDQxMywicGF0aCI6Ii84OTc0NDc3Ny8yNzAxNTQ1NzAtZmZmMmQ3MjgtYTkxYy00ZDcwLTgyYmYtYTdhOGU3NWFkNTcxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIwVDIxNDY1M1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdhYzVlZTBlMzVmZDY3Y2JiNzI3NGNlNzU0OWU2NTlkOTYyZGFhNDUxOGY2ZWU5MGY1NjEzNTI1YzAzZjYzZGQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.rmyG_jFlacvRHnpGy_8Kzza21r9nCm3lMDMwDFEOxs4)
Each cell has its own energy, genome, color, and more. The genome is a list of size 64, containing numbers from 0 to 64. Each number represents a command, for example, 25 stands for photosynthesis. When a command is executed, a number is added to a special "counter". When the "counter" reaches 64, the cell finishes its turn.
When a cell's energy reaches 650, reproduction occurs. If there is space around, the cell divides, and one number in the genome mutates with a certain probability. However, when a cell has more than 5 children, it dies.
And in the lower field, a cell appears with a genome that performs only photosynthesis, but over time the cell mutates.
You just need to run the 'main' file.
Also, the project uses the "numpy" and "pygame" libraries, which must be installed on you.
The project was inspired by these videos:
https://www.youtube.com/watch?v=PCx228KcOow&t=336s
https://www.youtube.com/watch?v=KLv0Z43ijyQ&t=258s
This project is distributed under the MIT license.