diff --git a/algorithms/medium/medium_algo.c b/algorithms/medium/medium_algo.c index 6de0c17..4491b2b 100644 --- a/algorithms/medium/medium_algo.c +++ b/algorithms/medium/medium_algo.c @@ -34,7 +34,7 @@ void bucket_algo(t_stacks *stacks, t_tab *preset, int range) t_tab *tmp; tmp = preset; - while(stacks->a) + while (stacks->a) pb(stacks); while (preset) { diff --git a/algorithms/medium/move_patha.c b/algorithms/medium/move_patha.c index a1b8aad..b092655 100644 --- a/algorithms/medium/move_patha.c +++ b/algorithms/medium/move_patha.c @@ -12,7 +12,7 @@ #include "medium_headers.h" #include "push_swap.h" -#include + static int is_border_a(int value, t_stacks *stacks) { t_stack *tmp; @@ -22,7 +22,7 @@ static int is_border_a(int value, t_stacks *stacks) tmp = assign_stack(stacks, 'a'); if ((value < tmp->index && check_order(tmp)) || (value > tmp->index && value > tmp->previous->index - && check_order(stacks->a))) + && check_order(stacks->a))) return (1); return (0); } diff --git a/algorithms/medium/move_pathb.c b/algorithms/medium/move_pathb.c index 1c67359..48a0858 100644 --- a/algorithms/medium/move_pathb.c +++ b/algorithms/medium/move_pathb.c @@ -104,10 +104,12 @@ int get_pre_move_b(t_stacks *stacks, t_tab *one_preset, int range) } } else + { while (!in_range(tmp->index, one_preset->max_range, range)) { i++; tmp = tmp->previous; } + } return (i); } diff --git a/algorithms/medium/sort_utils.c b/algorithms/medium/sort_utils.c index cddfec5..393d54b 100644 --- a/algorithms/medium/sort_utils.c +++ b/algorithms/medium/sort_utils.c @@ -12,7 +12,7 @@ #include "push_swap.h" #include "medium_headers.h" -#include + void move_rr_rrr(t_stacks *stacks, int move, char c) { int i; @@ -46,7 +46,7 @@ void path_rr_rrr(int value, t_stacks *stacks, t_tab *one_preset, int range) { int move_a; int final_move; - + final_move = get_pre_move_b(stacks, one_preset, range); if (wich_path_a(value, stacks) == 1 && wich_path(stacks, one_preset->max_range, range, 'b')) @@ -64,7 +64,6 @@ void path_rr_rrr(int value, t_stacks *stacks, t_tab *one_preset, int range) final_move = move_a; move_rr_rrr(stacks, final_move, 'e'); } - } void push_range_to_b(t_stacks *stacks, t_tab *one_preset, int range) diff --git a/algorithms/medium/sort_utils_two.c b/algorithms/medium/sort_utils_two.c index a79fce5..4380ef8 100644 --- a/algorithms/medium/sort_utils_two.c +++ b/algorithms/medium/sort_utils_two.c @@ -15,9 +15,9 @@ int get_value_finded(t_stacks *stacks, t_tab *one_preset, int range) { - int value; + int value; t_stack *tmp; - + tmp = assign_stack(stacks, 'b'); if (wich_path(stacks, one_preset->max_range, range, 'b')) { diff --git a/flags/algorithms_sort.c b/flags/algorithms_sort.c index c6cd752..8b0bfc6 100644 --- a/flags/algorithms_sort.c +++ b/flags/algorithms_sort.c @@ -55,7 +55,7 @@ void adaptive(t_stacks *stacks, char **tab) while (!ft_isdigit(tab[i][0]) && tab[i]) i++; disorder = stacks->disorder; - if (disorder < 0.3) + if (disorder < 0.2) simple(stacks); else if (disorder < 0.5) medium(stacks);