Skip to content

This is a python GUI app that helps visualize how the 42 project push_swap project works.

Notifications You must be signed in to change notification settings

xbeheydt/push_swap_visualizer

Repository files navigation

Push Swap Visualizer

This project is a fork from orginal https://github.com/o-reo/push_swap_visualizer. So special thank to o-reo for the project.

This is a python GUI app that helps visualize how the 42 project push_swap project works.

python 3.8 or more version supported !

Main view

PSViz App gui

Stack list generator view

PSViz stack list generator

Git exporter view

PSViz gif exporter

Yeah push_swap in action !

PSViz animated gif export

Features

  • cli parameters helps to pre-settings app.
  • push_swap launch timeout setting.
  • drawing the stack as a bar graph.
  • displays the command list produced by push_swapas a list.
  • playback speed configuration.
  • selection of frame corresponding to a push_swap command.
  • change path of push_swap directly in GUI.
  • stack generator.
  • GIF exporter

Installation

Only dev case will be seen.

macOs install

brew install python3

debian-like install

sudp apt update
sudo apt install python3 python3-pip python3-venv

make a virtualenv

Here we use venv for install python dépendancies :

# create an environnement
python3 -m venv .env

# activate env
source ./.env/bin/activate

Install dependancies

pip install -r requirements.txt

Usage

cli

About cli arguments, run python3 push_swap_visualizer.py -h.

usage: push_swap_visualizer.py [-h] [--path PATH] [-t MS] [-s FPS] [--min INT] [--max INT] [--size INT] [INT [INT ...]]

Push Swap Visualizer

positional arguments:
  INT                  your custom stack list

optional arguments:
  -h, --help           show this help message and exit
  --path PATH          'push_swap' path (default: ./push_swap)
  -t MS, --timeout MS  timeout setting to run push_swap (default: 12)
  -s FPS, --speed FPS  frame speed refresh (default: 25)
  --min INT            min value for stack generator (default: 0)
  --max INT            max value for stack generator (default: 100)
  --size INT           size value for stack generator (default: 10)

GUI

Main window

  • RUN : run or re-run push_swap with a specific stack.
  • STACK : open stack list window helps to view your stack or generate another.
  • << : got to previous frame. (only in pause mode playback)
  • > and | | : swith app in play or pause mode.
  • >> : got to next frame. (only in pause mode playback)
  • frame : in pause mode, enter the desired frame in frame entry and press Enter. (not keypad number enter key)
  • speed : in pause or play mode, enter the desired speed and press Enter. (not keypad number enter key)

Stack list window

  • min : sets min value wanted in stack.
  • max : sets max value wanted in stack.
  • size: sets number of element wanted in stack
  • shuffle: permits to generate a shuffled stack or not.
  • GENERATE : launch generation of a new stack. (stack generator not run or re-run in push_swap, please at this step click in main windows in the RUN)

Gif Exporter

  • FPS : frame per second speed gif export
  • path : path to save gif
  • RUN : run and export gif

TODO

  • TODO clean setters.
  • SWITCH player as a yield generator
  • FIX speed control in playback mode.
  • FIX ValueError in stack generator.
  • ADD KP_Enter for speed and frame setting.
  • ADD pydocs in all parts.
  • ADD setting in cli for gif exporter
  • FIX resizing gif

Credits

About

This is a python GUI app that helps visualize how the 42 project push_swap project works.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages