##### Try to run `"./push_swap <5 random numbers>"` with 5 random numbers instead of the tag.
##### Try to run `"./push_swap <5 random numbers>"` with 5 random numbers instead of the tag.
###### Does it displays a valid solution and less than 12 instructions?
###### Does it displays a valid solution and less than 12 instructions?
##### Try to run `"echo -e " " | ./checker "`.
###### Does it display the right result as above?
##### Try to run `"./checker "` and input nothing.
###### Does it display nothing?
##### Try to run `"./checker 0 one 2 3"`.
##### Try to run `"./checker 0 one 2 3"`.
```
```
Error
Error
```
```
###### Does it display the right result as above?
###### Does it display the right result as above?
##### Try to run `"./checker 1 2 2 3"`.
```
Error
```
###### Does it display the right result as above?
##### Try to run `"echo -e "sa\npb\nrrr\n" | ./checker 0 9 1 8 2 7 3 6 4 5"`.
##### Try to run `"echo -e "sa\npb\nrrr\n" | ./checker 0 9 1 8 2 7 3 6 4 5"`.
```
```
KO
KO
```
```
###### Does it display the right result as above?
###### Does it display the right result as above?
##### Try to run `"echo -e "pb\nra\npb\nra\nsa\nra\npa\npa\n" | ./checker 0 9 1 8 2"`.
##### Try to run `"echo -e "pb\nra\npb\nra\nsa\nra\npa\npa\n" | ./checker 0 9 1 8 2"`.
```
```
OK
OK
```
```
###### Does it display the right result as above?
###### Does it display the right result as above?
##### Try to run `"ARG = "4 67 3 87 23"; ./push_swap $ARG | ./checker $ARG"`.
##### Try to run `"ARG = "4 67 3 87 23"; ./push_swap $ARG | ./checker $ARG"`.
```
```
OK
OK
@ -49,14 +50,16 @@ OK
#### General
#### General
##### Try to run `"$ARG= "<100 random numbers>"; ./push_swap $ARG"` with 100 random different numbers instead of the tag.
##### Try to run `"$ARG= "<100 random numbers>"; ./push_swap $ARG"` with 100 random different numbers instead of the tag.
###### Does it displays less than 700 commands?
###### +Does it displays less than 700 commands?
##### Try to run `"$ARG= "<100 random numbers> | ./checker $ARG" ; ./push_swap $ARG"` with the same 100 random different numbers as before instead of the tag.
##### Try to run `"$ARG= "<100 random numbers>; ./push_swap $ARG | ./checker $ARG"` with the same 100 random different numbers as before instead of the tag.
###### Does it displays OK?
```
OK
```
###### +Does it displays the right result as above?
#### Basic
#### Basic
###### +Does the code obey the [good practices](https://github.com/01-edu/public/blob/master/subjects/good-practices.en.md)?
###### +Does the code obey the [good practices](https://github.com/01-edu/public/blob/master/subjects/good-practices.en.md)?
###### +Is there a test file for this code?
###### +Is there a test file for this code?
###### +Are the tests checking each possible case?
###### +Are the tests checking each possible case?
Push_swap is a very simple and highly effective algorithm.You have at your disposal a list of `int` values, two stacks (`a` and `b`) and a set of instructions.
Push_swap is a very simple and highly effective algorithm.You have at your disposal a list of `int` values, two stacks (`a` and `b`) and a set of instructions.
You will have two write 2 programs:
You will have to write 2 programs:
- **push_swap**, which calculates and displays on the standard output the smallest program using push_swap instruction language that sorts integer arguments received.
- **push_swap**, which calculates and displays on the standard output the smallest program using push_swap instruction language that sorts integer arguments received.
- **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**, 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`.
@ -28,7 +28,6 @@ These are the instructions that you can use to sort the stack :
#### Example
#### Example
```console
```console
---------------------------------------
Init a and b :
Init a and b :
2
2
1
1
@ -86,7 +85,6 @@ Exec pa pa pa:
8
8
= =
= =
a b
a b
---------------------------------------
```
```
This project will help you learn about :
This project will help you learn about :
@ -116,6 +114,7 @@ pa
pa
pa
student$ ./push_swap "0 one 2 3"
student$ ./push_swap "0 one 2 3"
Error
Error
student$ ./push_swap
student$
student$
```
```
@ -128,6 +127,13 @@ student$
- In case of there are no arguments the program displays nothing.
- In case of there are no arguments the program displays nothing.
```console
```console
student$ ./checker "3 2 1 0"
sa
rra
pb
KO
student$ echo -e "rra\npb\nsa\n" | ./checker "3 2 one 0"