mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-01-27 00:41:57 +00:00
finish the parsing solve the problem with 2 arg
This commit is contained in:
@@ -35,6 +35,11 @@ int r_to_lowest(t_stack *stack, int len)
|
||||
return (lowest_i);
|
||||
}
|
||||
|
||||
void sort_two(t_stacks *stacks)
|
||||
{
|
||||
sa(stacks);
|
||||
}
|
||||
|
||||
void sort_three_a(t_stacks *stacks)
|
||||
{
|
||||
if (check_order(stacks->a))
|
||||
|
||||
@@ -26,12 +26,19 @@ void medium(t_stacks *piles)
|
||||
{
|
||||
t_tab *buckets;
|
||||
int range;
|
||||
int len;
|
||||
|
||||
piles->algo = 2;
|
||||
len = stack_a_len(piles);
|
||||
if (len == 2)
|
||||
sort_two(piles);
|
||||
else
|
||||
{
|
||||
range = range_bucket(piles->a);
|
||||
buckets = get_tabs(piles->a, range);
|
||||
bucket_algo(piles, buckets, range);
|
||||
}
|
||||
}
|
||||
|
||||
void complex(t_stacks *piles)
|
||||
{
|
||||
|
||||
@@ -67,6 +67,7 @@ int highest_stack_len(t_stacks *stacks);
|
||||
/* PRE SORT */
|
||||
int r_to_lowest(t_stack *stack, int len);
|
||||
void sort_three_a(t_stacks *stacks);
|
||||
void sort_two(t_stacks *stacks);
|
||||
/* ITERATE FILE */
|
||||
void optimal_rotate(t_stacks *stacks, int i, int len, char stack);
|
||||
/* COMPARE FILE */
|
||||
|
||||
@@ -25,6 +25,8 @@ int test1(int argc, char **argv)
|
||||
piles = NULL;
|
||||
mod = calcul_mod(argc, argv);
|
||||
piles = init_piles(argc, argv, mod);
|
||||
if (check_order(piles->a))
|
||||
return (0);
|
||||
flags(pos_flag(argv, mod), pos_bench(argv, mod), argv, piles);
|
||||
if (piles->bench == 1)
|
||||
print_bench(piles);
|
||||
|
||||
Reference in New Issue
Block a user