This is a project from 42 school. The goal is to sort a stack of numbers using two stacks and a limited set of instructions.
- C
- greedy
- libft
- get_next_line
- ft_printf
- compile with
make
in root folder(push_swap/
) - run with
./push_swap [numbers]
- ex) ./push_swap 1 2 3 4 5
- ex) ./push_swap 1 -2 3 -4 5
- ex) ./push_swap 1 1 3 4 5 => error
- push_swap
make
: compile the project insrcs/
andlibft/
andft_printf/
,get_next_line/
make clean
: remove all .o filesmake fclean
: remove all .o files and the executablemake test
: compile the project and run the test intest/
folder
- sa / sb: Swap the first 2 elements at the top of stack a / b. Do nothing if there is only one or no elements.
- ss: sa and sb at the same time.
- pa / pb: Take the first element at the top of b / a and put it at the top of a / b. Do nothing if b / a is empty.
- ra / rb: Shift up all elements of stack a / b by 1. The first element becomes the last one.
- rr: ra and rb at the same time.
- rra / rrb: Shift down all elements of stack a / b by 1. The last element becomes the first one.
- rrr: rra and rrb at the same time.
- before evaluation