A sorting algorithm visualizer created with Raylib and C.
Arraystruct pointer type for dealing with variable-length arrays (see src/Array.c for documentation on how to use)Algorithmstruct type for dealing with algorithms (contains abool (*)(Array)function pointer andconst char *)- Procedurally-generated audio for clean sounds
I used Windows to create this but I'm sure it can be compiled on other platforms.
For Windows, run this command:
gcc src\main.c -o RaylibSortingVisualizer.exe -Iinclude -Llib -lraylib -lopengl32 -lgdi32 -lwinmm -pthread -O2To compile in debug mode, replace -O2 with -g.
You can get GCC for Windows here.
Please read the warnings at the top. Thank you!
- Add indicator for where array accesses are, with different colors for reads, writes, and both (commit bc540cc)
- Make the indicator more visible (commit f44feb7)
- Add sounds (commit ad13cd8)
- Add a HUD using a non-obtrusive color (commit ce77fdc)
- Add more algorithms
To contribute new algorithms, first read the documentation comments in src/Array.c to get an idea of how this visualizer implements algorithms and dynamically-sized arrays. Then go into the src/algorithms/sort folder and create a new file. In this file you will define a new Algorithm which contains the data for the sorting algorithm you're implementing. Finally, go into src/main.c, include the file you just created, and add a new call to show_sort under the long if-statement in the sort_proc function. For information on which arguments you should put into the show_sort call to make your new algorithm show properly, consult the documentation comments on show_sort.
I started this project in C, so I'm sticking with C, but man, do I wish I used Rust.