diff --git a/builds/algo.o b/builds/algo.o index 15f25ba..bf62126 100644 Binary files a/builds/algo.o and b/builds/algo.o differ diff --git a/builds/algo_bubble_sort.o b/builds/algo_bubble_sort.o index 2a7786b..0c034c7 100644 Binary files a/builds/algo_bubble_sort.o and b/builds/algo_bubble_sort.o differ diff --git a/builds/print.o b/builds/print.o index 6085fb4..b159a07 100644 Binary files a/builds/print.o and b/builds/print.o differ diff --git a/builds/push.o b/builds/push.o index 0e77e67..34a840f 100644 Binary files a/builds/push.o and b/builds/push.o differ diff --git a/builds/push_swap.o b/builds/push_swap.o index 5bfbf2c..8a07daf 100644 Binary files a/builds/push_swap.o and b/builds/push_swap.o differ diff --git a/builds/reverse_rotate.o b/builds/reverse_rotate.o index b3f6f9e..3022223 100644 Binary files a/builds/reverse_rotate.o and b/builds/reverse_rotate.o differ diff --git a/builds/rotate.o b/builds/rotate.o index b73699f..0105699 100644 Binary files a/builds/rotate.o and b/builds/rotate.o differ diff --git a/builds/stop.o b/builds/stop.o index b935031..ce7a3f8 100644 Binary files a/builds/stop.o and b/builds/stop.o differ diff --git a/builds/swap.o b/builds/swap.o index 7673fb8..8df6c67 100644 Binary files a/builds/swap.o and b/builds/swap.o differ diff --git a/includes/push_swap.h b/includes/push_swap.h index 5d40dee..9fcd482 100644 --- a/includes/push_swap.h +++ b/includes/push_swap.h @@ -23,7 +23,7 @@ int bubble_sort(t_stack **a, t_stack **b, t_list *solution); int check_flag(int *ac, char ***av); void is_valid(int ac, char **av); t_stack *init_stack(int ac, char **av); -t_list *launch_algo(t_stack *stack); +t_list *launch_algo(t_stack *stack, int i); /* ** stop.c diff --git a/push_swap b/push_swap index 3b0d16c..3aff82f 100755 Binary files a/push_swap and b/push_swap differ diff --git a/srcs/print.c b/srcs/print.c index db5202b..8fb063d 100644 --- a/srcs/print.c +++ b/srcs/print.c @@ -24,7 +24,6 @@ void fill_solution(t_list *solution, char *sp) char *stack; print_test(solution, "fill_solution (beginning)"); - tmp1 = solution->content; tmp2 = solution->next->content; a = *tmp1; @@ -44,22 +43,17 @@ print_test(solution, "fill_solution (beginning)"); stack = ft_strjoinfree(stack, ft_itoa(b->n)); b = b->next; } - print_test(solution, "fill_solu. (bfr add_back)"); - ft_lstadd_back(&solution, ft_lstnew(stack)); - print_test(solution, "fill_solu. (aft add_back)"); - } void print_result(t_list *result, int flag) { char **part; +print_test(result, "print result "); result = result->next->next; - if (!flag) - result = result->next; while (result) { part = ft_split(result->content, '!'); diff --git a/srcs/push_swap.c b/srcs/push_swap.c index ac685d1..602c4d1 100644 --- a/srcs/push_swap.c +++ b/srcs/push_swap.c @@ -56,7 +56,7 @@ t_stack *init_stack(int ac, char **av) ** then it calls the sorting algorithm ** then it calls ps_stop() to free everything that needs to be freed */ -t_list *launch_algo(t_stack *a) +t_list *launch_algo(t_stack *a, int flag) { t_stack *b; t_list *solution; @@ -64,18 +64,13 @@ t_list *launch_algo(t_stack *a) b = NULL; solution = ft_lstnew(&a); ft_lstadd_back(&solution, ft_lstnew(&b)); - print_test(solution, "launch_algo "); - - fill_solution(solution, ft_strdup("start")); - + if (flag) + fill_solution(solution, ft_strdup("start")); print_test(solution, "launch_algo (after fill) "); - hugo_sort(&a, &b, solution); //bubble_sort(&a, &b, solution); - print_test(solution, "launch_algo (bfr return) "); - return (solution); } @@ -96,12 +91,10 @@ int main(int ac, char **av) is_valid(ac, av); flag = check_flag(&ac, &av); stack = init_stack(ac, av); - result = launch_algo(stack); - + result = launch_algo(stack, flag); print_test(result, "main "); //sa(&stack, &result); -print_result(result, flag); - + print_result(result, flag); ps_stop(NULL, result, 0); return(0); }