mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-01-27 08:41:58 +00:00
trying some opti start to opti
This commit is contained in:
@@ -13,25 +13,24 @@
|
||||
#include "push_swap.h"
|
||||
#include "medium_headers.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static int path_to_end(t_stacks *stacks, int max_range, int range, char c)
|
||||
{
|
||||
t_stack *tmp;
|
||||
t_stack *start;
|
||||
int i;
|
||||
int first_pass;
|
||||
|
||||
if (c == 'a')
|
||||
tmp = stacks->a;
|
||||
else
|
||||
tmp = stacks->b;
|
||||
tmp = assign_stack(stacks, c);
|
||||
start = assign_stack(stacks, c);
|
||||
tmp = tmp->previous;
|
||||
i = 0;
|
||||
first_pass = 1;
|
||||
while (first_pass || tmp != stacks->b->previous)
|
||||
while (first_pass || tmp != start->previous)
|
||||
{
|
||||
first_pass = 0;
|
||||
if (in_range(tmp->value, max_range, range))
|
||||
tmp = stacks->b;
|
||||
tmp = start;
|
||||
tmp = tmp->previous;
|
||||
i++;
|
||||
}
|
||||
@@ -45,8 +44,8 @@ static int path_to_start(t_stacks *stacks, int max_range, int range, char c)
|
||||
int i;
|
||||
int first_pass;
|
||||
|
||||
tmp = (stacks, c);
|
||||
start = (stacks, c);
|
||||
tmp = assign_stack(stacks, c);
|
||||
start = assign_stack(stacks, c);
|
||||
i = 0;
|
||||
first_pass = 1;
|
||||
while (first_pass || tmp != start)
|
||||
@@ -94,7 +93,8 @@ void bucket_algo(t_stacks *stacks, t_tab *preset, int range)
|
||||
t_tab *tmp;
|
||||
|
||||
tmp = preset;
|
||||
medium_pre_sort(stacks, preset, range);
|
||||
while(stacks->a)
|
||||
pb(stacks);
|
||||
while (preset)
|
||||
{
|
||||
push_range_to_b(stacks, preset, range);
|
||||
|
||||
Reference in New Issue
Block a user