Algorithms and their visualization implemented in Python
We consider a square grid of length n = 2l with a forbiden square of coordinate i, j. We want to pave the grid (except the forbiden square) with tiles of three square in form of L.
python3 lpavage.py l speed
With
- 2l the length of the square
- speed the time in ms between each step of the algorithm
tkinter
3 graph exploration algorithm are implemented in astar.py
- A*
- Weighted A*
- Breadth First Search (same as Dijkstra in this case)
python3 astar.py w
w
is an option, it is the weight of heuristic in weighted A*, there is 3 possibility
- 0: there isn't any heuristic and A* juste become Breadth first search
- 1: basic A* heuristic (
python3 astar.py
also does the basic A* algorithm) - >1: Weighted A* with a weight of
w
- Start drawing the wall of your grid
- Press space when you want to place the start node
- Left click to place it
- Then left click again to place the goal node
- Press space to reset the grid and start again
In green you will have the shortest path
In yellow, all the explored node
In magenta, all the discovered, but not explored node
In white all the non discovered node
pygame
A simple visualization of Conway's famous Game of Life
python3 game_of_life.py
pygame
A sudoku resolver using the backtracking algorithm
python3 backtracking.py
python3 backtracking.py file
where file is a file describing a sudoku
To describe a sudoku the file must contain 9 row of 9 numbers without any space (only numbers and line break). Empty box of the sudoku should be replaced by 0. You can see an example here, which is the default used sudoku.
pygame
tkinter