This project implements a genetic algorithm to visualize pathfinding in a game board environment using PyQt5. The genetic algorithm generates samples (individuals) that navigate from a start point to an end point on the game board while avoiding obstacles.
![Screencast-from-28-03-2024-13_23_15](https://github.com/UmutDeniz26/Path_Finder_Genetic/assets/76654674/32c3b310-d07e-453e-b301-646d3958a58e)
- Genetic Algorithm: The pathfinding is achieved through a genetic algorithm that evolves a population of samples over generations.
- Visualization: The PyQt5 framework is used to visualize the game board, samples, obstacles, and end point.
- Customizable Parameters: Parameters such as learning rate, mutation rate, sample speed, and board size can be adjusted to fine-tune the pathfinding behavior.
- Dynamic Obstacle Placement: Users can dynamically add obstacles by clicking and dragging on the game board.
- Python 3.x
- PyQt5
-
Clone the repository:
git clone https://github.com/your_username/genetic-algorithm-pathfinding.git
-
Install dependencies:
pip install mkl numpy PyQt5 # See requirements.txt for detailed dependencies
-
Run the main script:
python main.py
-
Use the following controls:
- Left Click: Add obstacles by clicking and dragging on the game board.
- Enter/Return Key: Pause/resume the pathfinding process.
- Mouse Movement: Adjust the size and position of obstacles.
-
Observe the pathfinding process as samples evolve and navigate towards the end point.
You can customize various parameters in the main.py
file, such as:
- Learning rate
- Mutation rate
- Sample_qt speed
- Board size
- Generation multiplier
- Select per epoch