mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-01-27 08:41:58 +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);
|
return (lowest_i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sort_two(t_stacks *stacks)
|
||||||
|
{
|
||||||
|
sa(stacks);
|
||||||
|
}
|
||||||
|
|
||||||
void sort_three_a(t_stacks *stacks)
|
void sort_three_a(t_stacks *stacks)
|
||||||
{
|
{
|
||||||
if (check_order(stacks->a))
|
if (check_order(stacks->a))
|
||||||
|
|||||||
@@ -26,11 +26,18 @@ void medium(t_stacks *piles)
|
|||||||
{
|
{
|
||||||
t_tab *buckets;
|
t_tab *buckets;
|
||||||
int range;
|
int range;
|
||||||
|
int len;
|
||||||
|
|
||||||
piles->algo = 2;
|
piles->algo = 2;
|
||||||
range = range_bucket(piles->a);
|
len = stack_a_len(piles);
|
||||||
buckets = get_tabs(piles->a, range);
|
if (len == 2)
|
||||||
bucket_algo(piles, buckets, range);
|
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)
|
void complex(t_stacks *piles)
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ int highest_stack_len(t_stacks *stacks);
|
|||||||
/* PRE SORT */
|
/* PRE SORT */
|
||||||
int r_to_lowest(t_stack *stack, int len);
|
int r_to_lowest(t_stack *stack, int len);
|
||||||
void sort_three_a(t_stacks *stacks);
|
void sort_three_a(t_stacks *stacks);
|
||||||
|
void sort_two(t_stacks *stacks);
|
||||||
/* ITERATE FILE */
|
/* ITERATE FILE */
|
||||||
void optimal_rotate(t_stacks *stacks, int i, int len, char stack);
|
void optimal_rotate(t_stacks *stacks, int i, int len, char stack);
|
||||||
/* COMPARE FILE */
|
/* COMPARE FILE */
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ int test1(int argc, char **argv)
|
|||||||
piles = NULL;
|
piles = NULL;
|
||||||
mod = calcul_mod(argc, argv);
|
mod = calcul_mod(argc, argv);
|
||||||
piles = init_piles(argc, argv, mod);
|
piles = init_piles(argc, argv, mod);
|
||||||
|
if (check_order(piles->a))
|
||||||
|
return (0);
|
||||||
flags(pos_flag(argv, mod), pos_bench(argv, mod), argv, piles);
|
flags(pos_flag(argv, mod), pos_bench(argv, mod), argv, piles);
|
||||||
if (piles->bench == 1)
|
if (piles->bench == 1)
|
||||||
print_bench(piles);
|
print_bench(piles);
|
||||||
|
|||||||
Reference in New Issue
Block a user