-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
85 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,85 @@ | ||
## TODOS | ||
- [ ] Add logs | ||
- [ ] Add tests | ||
- [x] Tail collision | ||
- [x] change gene values to int | ||
- [x] move files groups to different lib folders | ||
- [x] set max score | ||
- [ ] add neural network | ||
- [ ] use quantum machine learning | ||
- [ ] verify heap-stack usage | ||
- [x] add `#pragma once` | ||
- [x] check destructors | ||
- [ ] check the use of constants | ||
- [ ] check the use of references | ||
- [x] gh workflows | ||
|
||
|
||
- Chromossome | ||
- [ ] set genes as pointers | ||
- [ ] add deconstructor | ||
|
||
- Population | ||
- [ ] set individuals as pointers | ||
- [ ] add deconstructor | ||
|
||
- Player | ||
- [x] try to free the memory | ||
|
||
- Matrix | ||
- [x] scalar multiplication | ||
- [x] add throw error in `get_position_value` | ||
- [x] dot product | ||
- [x] destructor | ||
- [x] overload the `=` operator | ||
- [x] add test to `dot product` error | ||
# Snake game genetic algorithm | ||
|
||
![Build-Test workflow (cmake)](https://github.com/Dpbm/genetic-algorithm/actions/workflows/cmake-build-test.yml/badge.svg) | ||
|
||
*🚧In Progress🚧* | ||
|
||
The idea for this project came as a joint between my urge to learn `C++` and to implement a `AI` from scratch.\ | ||
So, actually, this project is a big lab for me, the main goal is to learn things like: | ||
|
||
* c++ | ||
* cmake/make | ||
* ctest | ||
* AI algorithms | ||
* docker | ||
* SDL2 | ||
|
||
Bellow there're some youtube videos that have inspired me to create this project: | ||
|
||
|
||
[![Artificial Intelligence in Google's Dinosaur (English Sub)](https://img.youtube.com/vi/P7XHzqZjXQs/0.jpg)](https://youtu.be/P7XHzqZjXQs) | ||
[![Rede Neural aprendendo a jogar o jogo da cobrinha (SNAKE) | ||
](https://img.youtube.com/vi/awz1ghokP3k/0.jpg)](https://youtu.be/awz1ghokP3k) | ||
[![MarI/O - Machine Learning for Video Games](https://img.youtube.com/vi/qv6UVOQ0F44/0.jpg)](https://youtu.be/qv6UVOQ0F44) | ||
|
||
|
||
## Technologies | ||
|
||
Here are listed the technologies used for this project: | ||
|
||
* [git](https://git-scm.com/) | ||
* [SDL2](https://www.libsdl.org/) | ||
* [C++](https://isocpp.org/) | ||
* [make](https://www.gnu.org/software/make/)/[cmake](https://cmake.org/) | ||
* [googletest (ctest)](https://google.github.io/googletest/) | ||
* [sh](https://www.gnu.org/software/bash/) | ||
* [Github actions](https://docs.github.com/en/actions) | ||
|
||
|
||
## Dev usage | ||
|
||
to build the and run the project you must have a `linux distro` and the following tools and libraries installed: | ||
|
||
* [git](https://git-scm.com/) | ||
* [SDL2](https://www.libsdl.org/) | ||
* [C++](https://isocpp.org/) | ||
* [make](https://www.gnu.org/software/make/) | ||
* [cmake](https://cmake.org/) | ||
* [sh](https://www.gnu.org/software/bash/) | ||
|
||
with all that seted up, clone the project, go to thedirectory and run the `compilation script` as: | ||
|
||
```bash | ||
git clone https://github.com/Dpbm/genetic-algorithm | ||
cd ./genetic-algorithm | ||
chmod +x ./compile.sh ./clean.sh | ||
./clean.sh && ./compile.sh | ||
``` | ||
|
||
then, to run the project type: | ||
```bash | ||
./build/ga.out | ||
``` | ||
|
||
and to run the tests: | ||
|
||
```bash | ||
cd build | ||
ctest | ||
``` | ||
|
||
## Project Structure | ||
|
||
The project implements all from scratch, and the sub-libraries are organized in the following structure: | ||
|
||
1. [game](./game): This folder contains all the implementation of the snake game itself, | ||
SDL abstractions, etc. | ||
|
||
2. [genetic](./genetic): The genetic algorithm utils, like genes and chromossomes code. | ||
|
||
3. [matrix](./matrix): The sub-library to handle matrices in a simple way. | ||
|
||
4. [utils](./utils): Some uility functions, like random. | ||
|
||
Then all this is embedded into the [main.cpp](./main.cpp) file, to build the project altogether. | ||
|