push_swap
This project was made as a tool to visualize push_swap project from école 42.
The goal is to sort random numbers in ascending order into stack_a with the minimum possible number of operations.
To do this you have the following operations at your disposal:
- sa : swap a - swap the first 2 elements at the top of stack_a.
- sb : swap b - swap the first 2 elements at the top of stack_b.
- ss : sa and sb at the same time.
- pa : push a - take the first element at the top of b and put it at the top of a. Do nothing if b is empty.
- pb : push b - take the first element at the top of a and put it at the top of b. Do nothing if a is empty.
- ra : rotate a - shift up all elements of stack_a by 1. The first element becomes the last one.
- rb : rotate b - shift up all elements of stack_b by 1. The first element becomes the last one.
- rr : ra and rb at the same time.
- rra : reverse rotate a - shift down all elements of stack_a by 1. The last element becomes the first one.
- rrb : reverse rotate b - shift down all elements of stack_b by 1. The last element becomes the first one.
- rrr : rra and rrb at the same time.
made with love in a cold pandemic weekend by paula, 42SP student, and vinicius.
Any issues please let us know ;)
Leave a comment
Log in with itch.io to leave a comment.