diff --git a/flags/algorithms_sort.c b/flags/algorithms_sort.c index e78c48e..be23889 100644 --- a/flags/algorithms_sort.c +++ b/flags/algorithms_sort.c @@ -19,7 +19,6 @@ void simple(t_stacks *stacks) int len; len = stack_a_len(stacks); - stacks->algo = 1; insertion(stacks, len); } @@ -29,7 +28,6 @@ void medium(t_stacks *stacks) int range; int len; - stacks->algo = 2; len = stack_a_len(stacks); if (len == 2) sort_two(stacks); @@ -45,7 +43,6 @@ void medium(t_stacks *stacks) void complex(t_stacks *stacks) { - stacks->algo = 3; radix(stacks); } @@ -55,6 +52,7 @@ void adaptive(t_stacks *stacks, char **tab) float disorder; i = 0; + stacks->algo = 4; while (!ft_isdigit(tab[i][0]) && tab[i]) i++; disorder = stacks->disorder; diff --git a/flags/flag.c b/flags/flag.c index 2d1f71c..9cbb855 100644 --- a/flags/flag.c +++ b/flags/flag.c @@ -62,11 +62,20 @@ int pos_bench(char **argv, int mod) void flags(int pos, int pos_b, char **argv, t_stacks *stacks) { if (ft_strncmp(argv[pos], "--simple", 30) && pos > 0) + { + stacks->algo = 1; simple(stacks); + } else if (ft_strncmp(argv[pos], "--medium", 30) && pos > 0) + { + stacks->algo = 2; medium(stacks); + } else if (ft_strncmp(argv[pos], "--complex", 30) && pos > 0) + { + stacks->algo = 3; complex(stacks); + } else if (ft_strncmp(argv[pos], "--adaptive", 30) && pos > 0) adaptive(stacks, argv); else