This repo contains for the project group of the course Bio-Inspired Artificial Intelligence held at the University of Trento.
git clone https://github.com/pybox2d/pybox2d
- Download SWIG
- Unzip and add
swigwin-4.0.1
to yourSystem Variables PATH
(environment variable). cd /path/to/pybox2d/clone/location
python setup.py build
python setup.py install
sudo apt-get install swig
git clone https://github.com/pybox2d/pybox2d
cd /path/to/pybox2d/clone/location
python setup.py build
sudo python setup.py install
brew install swig
git clone https://github.com/pybox2d/pybox2d
cd /path/to/pybox2d/clone/location
python setup.py build
sudo python setup.py install
To test open a new Python terminal:<br>
import Box2D
Box2D.__version__
If everything goes right, you should see a version printed.<br>
You can now run pip3 install -r requirements.txt
to finish installing the below requirements:
- numpy
- pyqt5
- dill
The code is composed of:
- boxcar directory: contains all the file for car, wheel and floor managment
- genetic_algorithm directory: contains all the files that regars the GAs (crossover, mutation, selection) and the population
- settings.py: contains all the information about the GA and graphics stuff
- windows.py: contains the classes that draw the windows of the second window
- PyGenoCar.py: is the main file
To test the code, you just need to run the PyGenoCar.py file, and a window will open where you can select the environment's features, such as the type of flooring, the gravity of the environment, and the shape of the tile.
Afterwards, there are options for saving the generated populations, video recording, replay, and testing.
When you click the "Set Parameters" button, the world will be generated, and you will see your population within it.
In the second window, you will notice multiple interface elements. There is a main window where you can see the cars moving on the selected track.
In the bottom left corner, there is a window that displays all the key features of the Genetic Algorithm.
In the top right corner, there is a chart that represents the colors assigned to the chassis and wheels based on their density. In the bottom right corner, there are settings related to the car.