-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpush_swap.c
35 lines (32 loc) · 1.32 KB
/
push_swap.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dfurneau <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/15 14:13:27 by dfurneau #+# #+# */
/* Updated: 2021/12/11 06:30:39 by dfurneau ### ########.fr */
/* */
/* ************************************************************************** */
#include "./includes/push_swap.h"
/**
* Main Entry into push_swap
* Program
**/
int main(int ac, char **av)
{
t_stack a;
t_stack b;
parser(ac, av, &a, &b);
if (!is_sorted(&a) && a.len <= 3)
sort3(&a);
if (!is_sorted(&a) && (a.len > 3 && a.len <= 5))
sort5(&a, &b);
if (!is_sorted(&a) && (a.len > 5 && a.len <= 100))
sort100(&a, &b);
if (!is_sorted(&a) && (a.len > 100))
sort500(&a, &b);
free_stack(&a, &b);
return (EXIT_SUCCESS);
}