https://github.com/uvarovag/42_push_swap
The project efficient sorting two stacks, limited set of commands.
https://github.com/uvarovag/42_push_swap
42 42born2code 42projects 42school push-swap
Last synced: 4 months ago
JSON representation
The project efficient sorting two stacks, limited set of commands.
- Host: GitHub
- URL: https://github.com/uvarovag/42_push_swap
- Owner: uvarovag
- Created: 2019-08-10T14:01:19.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-09-17T08:39:49.000Z (over 3 years ago)
- Last Synced: 2023-08-16T13:30:03.873Z (almost 2 years ago)
- Topics: 42, 42born2code, 42projects, 42school, push-swap
- Language: C
- Homepage:
- Size: 40 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 42_push_swap
## The “checker” program
The first, named checker which takes integer arguments and reads instructions on
the standard output. Once read, checker executes them and displays OK if integers
are sorted. Otherwise, it will display KO.
```
$>./checker 3 2 1 0
rra
pb
sa
rra
pa
OK
```
## The “push_swap” program
The second one called push_swap which calculates and displays on the standard
output the smallest progam using Push_swap instruction language that sorts integer arguments received.
There’s only a few moves you’re allowed to used to manipulate the stacks that we’re going to called “Actions”. The main goal of this project is to organize Stack A in as few actions as possible.```
$>./push_swap 2 1 3 6 5 8
sa
pb
pb
pb
sa
pa
pa
pa
```## Here’s how they all work:

```
The actions are named: sa, sb, ss, ra, rb, rr, rra, rrb, rrr, pa, pb.
```### Sample commands "sa, sb, ss"
### Sample comamnds "ra, rb, rr"
### Sample commands "rra, rrb, rrr"
### Sample commands "pa, pb"
[source of images](https://medium.com/@jamierobertdawson/push-swap-the-least-amount-of-moves-with-two-stacks-d1e76a71789a)
## Makefile rules
* all
* re
* clean
* fclean