-
Notifications
You must be signed in to change notification settings - Fork 0
/
push_swap.c
41 lines (38 loc) · 1.34 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
36
37
38
39
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* push_swap.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: vpescete <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/11 17:58:11 by vpescete #+# #+# */
/* Updated: 2023/02/20 18:14:18 by vpescete ### ########.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
int main(int ac, char **av)
{
t_stack *stack;
t_topush topush;
int i;
int len;
int j;
len = 0;
stack = ft_init(av, ac, stack, 1);
len += ft_sorting(stack);
j = stack->current_a;
i = -1;
while (++i < j - 3)
{
topush = ft_count_moves(stack);
ft_realsort(stack, topush);
}
ft_find_maxmin_a(stack);
ft_sorting_a(stack);
i = stack->current_b;
j = -1;
while (++j < i)
ft_pushing_to_a(stack);
final_sorting(stack);
ft_close(stack);
}