A program to visualize the solution of push_swap. Using 42's MiniLibX and Libft.
Firstly, copy the repository into the same folder where your push_swap file is.
Warning
Your push_swap file must exist
git clone https://github.com/alexpg7/push_swap_visualizer.git push_swap_visualizer && cd push_swap_visualizerBefore compiling, make sure you have the correct permissions to compile the MiniLibX.
chmod 777 mlx_linux/configureNow, inside the push_swap_visualizer folder, just execute the following command:
make exec ARG="9 8 1 2 5 4 3 7 6"Caution
Sometimes the compilation of MiniLibX can give trouble with the -lbsd flag. Just execute make again until you have the ps_visualizer executable.
Where you can put whatever combination of numbers you want. The program uses the numbers (ARG) to feed the arguments of push_swap, the output is piped to ps_visualizer with the same arguments (ARG).
Of course, you can also try to execute
./ps_visualizer 9 8 1 2 5 4 3 7 6and figure out the solution by yourself 😆
If you want to try a specific number of arguments (for example, 100), execute this command:
make exec ARG="$(echo $(shuf -i 1-100 -n 100))"Once the mlx window has oppened up, use your keys ⬅️ and ➡️ (Linux) to go back and forth through all the instructions your push_swap has outputed. To exit the program, just click the close button of the window (the cross ❎).
The continuous pressing of the right arrow, for 100 numbers, should look like this (sped up):
