mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-01-27 00:41:57 +00:00
finish to link all the files
This commit is contained in:
14
Makefile
14
Makefile
@@ -6,6 +6,8 @@ STACK_UTILS_DIR = stack_utils
|
||||
|
||||
ALGO_UTILS_DIR = algorithms/utils
|
||||
|
||||
INSERT_DIR = algorithms/insertion
|
||||
|
||||
ALGO_DIR = algorithms
|
||||
|
||||
PARS_DIR = parsing
|
||||
@@ -20,20 +22,23 @@ INCLUDES = headers
|
||||
|
||||
SRC = main.c test_one.c
|
||||
|
||||
INSERTION = insertion.c
|
||||
|
||||
PARSING = ft_atoi.c parsing.c parsing_2.c
|
||||
|
||||
STACK_UTILS = push.c rev_rotate.c rotate.c stack_add.c stack_remove.c swap.c
|
||||
STACK_UTILS = push.c rev_rotate.c rotate.c stack_add.c stack_remove.c stacks_len.c swap.c print_stacks.c
|
||||
|
||||
MEDIUM_ALGO = utils_medium.c utils_struct_tab.c utils_medium_two.c sort_utils.c sort_utils_two.c medium_algo.c
|
||||
|
||||
ALGO_UTILS = check_order.c compare_value.c
|
||||
ALGO_UTILS = check_order.c compare.c iterate.c pre_sort.c
|
||||
|
||||
#============================
|
||||
# ADDING PATH TO THE FILES
|
||||
#============================
|
||||
|
||||
ALL_FILES = $(SRC) $(STACK_UTILS_DIR)/$(STACK_UTILS) $(PARS_DIR)/$(PARSING) \
|
||||
$(ALGO_DIR)/$(MEDIUM_DIR)/$(MEDIUM_ALGO) $(ALGO_UTILS_DIR)/$(ALGO_UTILS)
|
||||
$(ALGO_DIR)/$(MEDIUM_DIR)/$(MEDIUM_ALGO) $(ALGO_UTILS_DIR)/$(ALGO_UTILS) \
|
||||
$(INSERT_DIR)/$(INSERTION)
|
||||
|
||||
OBJ_DIR = obj
|
||||
|
||||
@@ -62,6 +67,9 @@ $(OBJ_DIR)/%.o: %.c | $(OBJ_DIR)
|
||||
$(OBJ_DIR)/%.o: $(PARS_DIR)/%.c | $(OBJ_DIR)
|
||||
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
|
||||
|
||||
$(OBJ_DIR)/%.o: $(INSERT_DIR)/%.c | $(OBJ_DIR)
|
||||
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
|
||||
|
||||
$(OBJ_DIR)/%.o: $(STACK_UTILS_DIR)/%.c | $(OBJ_DIR)
|
||||
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "push_swap.h"
|
||||
#include "medium_headers.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
static int path_to_end(t_stacks *piles, int max_range, int range, char c)
|
||||
|
||||
@@ -11,43 +11,9 @@
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "push_swap.h"
|
||||
#include "medium_headers.h"
|
||||
|
||||
void push_range_to_b(t_stacks *piles, t_tab *one_preset, int range)
|
||||
{
|
||||
while (one_preset->nb_in > 0)
|
||||
{
|
||||
if (wich_path(piles, one_preset->max_range, range, 'b'))
|
||||
{
|
||||
while (!in_range(piles->b->value, one_preset->max_range, range))
|
||||
rb(piles);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (!in_range(piles->b->value, one_preset->max_range, range))
|
||||
{
|
||||
rrb(piles);
|
||||
}
|
||||
}
|
||||
sort_little_pile(piles);
|
||||
one_preset->nb_in--;
|
||||
}
|
||||
}
|
||||
|
||||
int sort_path(t_stacks *piles, int value)
|
||||
{
|
||||
int start_path;
|
||||
int end_path;
|
||||
|
||||
start_path = number_move_reverse(piles, value, 's');
|
||||
if (start_path == 0)
|
||||
return (1);
|
||||
end_path = number_move_reverse(piles, value, 'e');
|
||||
if (start_path < end_path)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int number_move_reverse(t_stacks *piles, int value, char start_end)
|
||||
static int number_move_reverse(t_stacks *piles, int value, char start_end)
|
||||
{
|
||||
int i;
|
||||
t_stack *tmp;
|
||||
@@ -74,7 +40,21 @@ int number_move_reverse(t_stacks *piles, int value, char start_end)
|
||||
return (i);
|
||||
}
|
||||
|
||||
void sort_little_pile(t_stacks *piles)
|
||||
static int sort_path(t_stacks *piles, int value)
|
||||
{
|
||||
int start_path;
|
||||
int end_path;
|
||||
|
||||
start_path = number_move_reverse(piles, value, 's');
|
||||
if (start_path == 0)
|
||||
return (1);
|
||||
end_path = number_move_reverse(piles, value, 'e');
|
||||
if (start_path < end_path)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void sort_little_pile(t_stacks *piles)
|
||||
{
|
||||
if (!piles->a)
|
||||
{
|
||||
@@ -92,3 +72,24 @@ void sort_little_pile(t_stacks *piles)
|
||||
else
|
||||
sort_from_right(piles);
|
||||
}
|
||||
|
||||
void push_range_to_b(t_stacks *piles, t_tab *one_preset, int range)
|
||||
{
|
||||
while (one_preset->nb_in > 0)
|
||||
{
|
||||
if (wich_path(piles, one_preset->max_range, range, 'b'))
|
||||
{
|
||||
while (!in_range(piles->b->value, one_preset->max_range, range))
|
||||
rb(piles);
|
||||
}
|
||||
else
|
||||
{
|
||||
while (!in_range(piles->b->value, one_preset->max_range, range))
|
||||
{
|
||||
rrb(piles);
|
||||
}
|
||||
}
|
||||
sort_little_pile(piles);
|
||||
one_preset->nb_in--;
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,9 @@
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "push_swap.h"
|
||||
#include "medium_headers.h"
|
||||
|
||||
int get_max_number(t_stack *first)
|
||||
static int get_max_number(t_stack *first)
|
||||
{
|
||||
int max;
|
||||
t_stack *a;
|
||||
@@ -28,7 +29,7 @@ int get_max_number(t_stack *first)
|
||||
return (max);
|
||||
}
|
||||
|
||||
int get_min_number(t_stack *first)
|
||||
static int get_min_number(t_stack *first)
|
||||
{
|
||||
int min;
|
||||
t_stack *a;
|
||||
@@ -44,7 +45,7 @@ int get_min_number(t_stack *first)
|
||||
return (min);
|
||||
}
|
||||
|
||||
int my_sqrt(int nb)
|
||||
static int my_sqrt(int nb)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
@@ -11,9 +11,10 @@
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "push_swap.h"
|
||||
#include "medium_headers.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
t_tab *allocate_tab(int range_max, int nb)
|
||||
static t_tab *allocate_tab(int range_max, int nb)
|
||||
{
|
||||
t_tab *tab;
|
||||
|
||||
@@ -26,6 +27,45 @@ t_tab *allocate_tab(int range_max, int nb)
|
||||
return (tab);
|
||||
}
|
||||
|
||||
static t_tab *free_tab(t_tab **first)
|
||||
{
|
||||
if (!(*first))
|
||||
return (NULL);
|
||||
if ((*first)->next)
|
||||
free_tab(&(*first)->next);
|
||||
free(*first);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static t_tab *init_first_tab(t_stack *first, int range)
|
||||
{
|
||||
t_tab *tab;
|
||||
int lower;
|
||||
int range_max;
|
||||
|
||||
lower = get_first_lower(first);
|
||||
range_max = calcul_range(lower, range);
|
||||
tab = allocate_tab(range_max, get_number_in_range(range_max, first, range));
|
||||
if (!tab)
|
||||
return (NULL);
|
||||
return (tab);
|
||||
}
|
||||
|
||||
static t_tab *get_next_tab(t_stack *first, t_tab *tab, int range)
|
||||
{
|
||||
int lower;
|
||||
int range_max;
|
||||
t_tab *next_tab;
|
||||
|
||||
lower = get_next_lower(first, tab->max_range);
|
||||
range_max = calcul_range(lower, range);
|
||||
next_tab = allocate_tab(range_max,
|
||||
get_number_in_range(range_max, first, range));
|
||||
if (!next_tab)
|
||||
return (NULL);
|
||||
return (next_tab);
|
||||
}
|
||||
|
||||
t_tab *get_tabs(t_stack *first, int range)
|
||||
{
|
||||
t_tab *tmp;
|
||||
@@ -49,40 +89,3 @@ t_tab *get_tabs(t_stack *first, int range)
|
||||
}
|
||||
return (first_tab);
|
||||
}
|
||||
|
||||
t_tab *init_first_tab(t_stack *first, int range)
|
||||
{
|
||||
t_tab *tab;
|
||||
int lower;
|
||||
int range_max;
|
||||
|
||||
lower = get_first_lower(first);
|
||||
range_max = calcul_range(lower, range);
|
||||
tab = allocate_tab(range_max, get_number_in_range(range_max, first, range));
|
||||
if (!tab)
|
||||
return (NULL);
|
||||
return (tab);
|
||||
}
|
||||
|
||||
t_tab *get_next_tab(t_stack *first, t_tab *tab, int range)
|
||||
{
|
||||
int lower;
|
||||
int range_max;
|
||||
t_tab *next_tab;
|
||||
|
||||
lower = get_next_lower(first, tab->max_range);
|
||||
range_max = calcul_range(lower, range);
|
||||
next_tab = allocate_tab(range_max,
|
||||
get_number_in_range(range_max, first, range));
|
||||
return (next_tab);
|
||||
}
|
||||
|
||||
t_tab *free_tab(t_tab **first)
|
||||
{
|
||||
if (!(*first))
|
||||
return (NULL);
|
||||
if ((*first)->next)
|
||||
free_tab(&(*first)->next);
|
||||
free(*first);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* compare_value.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: mteriier <mteriier@student.42lyon.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/12/10 11:08:35 by mteriier #+# #+# */
|
||||
/* Updated: 2025/12/10 11:28:58 by mteriier ### ########lyon.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "push_swap.h"
|
||||
|
||||
int is_upper_compare(t_stack *t1, t_stack *t2)
|
||||
{
|
||||
if (t1->value > t2->value)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include "push_swap.h"
|
||||
|
||||
void iterate_fn(t_stacks *stacks, int i, void (f)(t_stacks *stacks))
|
||||
static void iterate_fn(t_stacks *stacks, int i, void (f)(t_stacks *stacks))
|
||||
{
|
||||
while (i > 0)
|
||||
{
|
||||
|
||||
@@ -24,10 +24,18 @@ typedef struct s_tab
|
||||
int wich_path(t_stacks *piles, int max_range, int range, char c);
|
||||
int stack_len(t_stack *stack);
|
||||
void bucket_algo(t_stacks *piles, t_tab *preset, int range);
|
||||
/* SORT UTILS 2 FILE */
|
||||
/* SORT UTILS FILES */
|
||||
void sort_from_left(t_stacks *piles);
|
||||
void sort_from_right(t_stacks *piles);
|
||||
/* SORT UTILS FILE */
|
||||
|
||||
void push_range_to_b(t_stacks *piles, t_tab *one_preset, int range);
|
||||
/* MEDIUM UTILS FILES */
|
||||
int range_bucket(t_stack *first);
|
||||
int get_first_lower(t_stack *first);
|
||||
int get_next_lower(t_stack *first, int old_lower);
|
||||
int calcul_range(int value, int range);
|
||||
int in_range(int value, int max_range, int range);
|
||||
int get_number_in_range(int max_range, t_stack *a, int range);
|
||||
/* UTILS STRUCT TAB FILE */
|
||||
t_tab *get_tabs(t_stack *first, int range);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,4 +10,11 @@
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef PARSING_H
|
||||
# define PARSING_H
|
||||
|
||||
int ft_atoi(const char *nptr);
|
||||
t_stacks *init_big_stacks2(int *tab, int len);
|
||||
t_stacks *init_big_stacks(int argc, char **argv);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,13 +26,8 @@ typedef struct s_stacks
|
||||
t_stack *b;
|
||||
} t_stacks;
|
||||
|
||||
typedef struct s_tab
|
||||
{
|
||||
int max_range;
|
||||
int nb_in;
|
||||
struct s_tab *next;
|
||||
} t_tab;
|
||||
|
||||
/* PRINT STACK FUNCTION*/
|
||||
void print_stacks(t_stacks *stacks, int len, t_stack *a, t_stack *b);
|
||||
/*STACK_FUNCTIONS*/
|
||||
void pa(t_stacks *stacks);
|
||||
void pb(t_stacks *stacks);
|
||||
@@ -45,73 +40,29 @@ void rr(t_stacks *stacks);
|
||||
void sa(t_stacks *stacks);
|
||||
void sb(t_stacks *stacks);
|
||||
void ss(t_stacks *stacks);
|
||||
|
||||
/*FUNCTION UTILS*/
|
||||
/* STACK ADD AND CLEAR FILES */
|
||||
t_stack *new_stack(int value);
|
||||
void stack_add_back(t_stack **stack, t_stack *new);
|
||||
void stack_add_front(t_stack **stack, t_stack *new);
|
||||
void stack_clear_all(t_stack *stack, t_stack *first);
|
||||
t_stack *parsing(int argc, char **argv);
|
||||
t_stacks *init_big_stacks(int argc, char **argv);
|
||||
int ft_atoi(const char *nptr);
|
||||
/*FUNCTION UTILS ALGO*/
|
||||
int check_order(t_stack *stack);
|
||||
int is_upper_compare(t_stack *t1, t_stack *t2);
|
||||
int stack_len(t_stack *stack);
|
||||
/*FUNCTION FOR MEDIUM ALGO*/
|
||||
t_tab *get_tabs(t_stack *first, int range);
|
||||
int get_number_in_range(int max_range, t_stack *a, int range);
|
||||
int in_range(int value, int max_range, int range);
|
||||
int calcul_range(int value, int range);
|
||||
int get_next_lower(t_stack *first, int old_lower);
|
||||
int get_first_lower(t_stack *first);
|
||||
int my_sqrt(int nb);
|
||||
int get_max_number(t_stack *first);
|
||||
int get_min_number(t_stack *first);
|
||||
int range_bucket(t_stack *first);
|
||||
t_tab *free_tab(t_tab **first);
|
||||
t_tab *get_next_tab(t_stack *first, t_tab *tab, int range);
|
||||
t_tab *init_first_tab(t_stack *first, int range);
|
||||
t_tab *allocate_tab(int range_max, int nb);
|
||||
int wich_path(t_stacks *piles, int max_range, int range, char c);
|
||||
int path_to_start(t_stacks *piles, int max_range, int range, char c);
|
||||
int path_to_end(t_stacks *piles, int max_range, int range, char c);
|
||||
void bucket_algo(t_stacks *piles, t_tab *preset, int range);
|
||||
void push_range_to_b(t_stacks *piles, t_tab *one_preset, int range);
|
||||
int sort_path(t_stacks *piles, int value);
|
||||
int number_move_reverse(t_stacks *piles, int value, char start_end);
|
||||
void sort_little_pile(t_stacks *piles);
|
||||
void sort_from_left(t_stacks *piles);
|
||||
void sort_from_right(t_stacks *piles);
|
||||
/*FUNCTION IN MAIN*/
|
||||
void print_all_stack(t_stack *stack, t_stack *first, char pile);
|
||||
int verif_no_double(int *tab, int len, int value);
|
||||
int adding_number(int *tab, int len);
|
||||
int *auto_shuffle(int len_tab);
|
||||
/*FUNCTION IN FILE TEST*/
|
||||
int test1(int argc, char **argv);
|
||||
int test2(char **argv);
|
||||
/*FUNCTION IN PARSIN 2*/
|
||||
t_stack *parsing2(int *tab, int len);
|
||||
t_stacks *init_big_stacks2(int *tab, int len);
|
||||
void print_tabs(t_tab *preset);
|
||||
void print_stacks(t_stacks *stacks, int len, t_stack *a, t_stack *b);
|
||||
/* STACKS LEN FILES */
|
||||
int stack_a_len(t_stacks *stacks);
|
||||
int stack_b_len(t_stacks *stacks);
|
||||
int highest_stack_len(t_stacks *stacks);
|
||||
|
||||
/*ALGORITHM UTILS*/
|
||||
int check_order(t_stack *stack);
|
||||
void iterate_fn(t_stacks *stacks, int i, void (f)(t_stacks *stacks));
|
||||
int is_lowest(t_stack *stack, t_stack *node, int len);
|
||||
int is_highest(t_stack *stack, t_stack *node, int len);
|
||||
void optimal_rotate(t_stacks *stacks, int i, int len, char stack);
|
||||
/* PRE SORT */
|
||||
int r_to_lowest(t_stack *stack, int len);
|
||||
void sort_three_a(t_stacks *stacks);
|
||||
|
||||
/*ALGORITHMS*/
|
||||
void bubble_alg(t_stacks *stacks);
|
||||
//void insertion(t_stacks *stacks, int a_len, int b_len);
|
||||
/* ITERATE FILE */
|
||||
void optimal_rotate(t_stacks *stacks, int i, int len, char stack);
|
||||
/* COMPARE FILE */
|
||||
int is_lowest(t_stack *stack, t_stack *node, int len);
|
||||
int is_highest(t_stack *stack, t_stack *node, int len);
|
||||
/* CHECK ORDER FILE */
|
||||
int check_order(t_stack *stack);
|
||||
/* INSERTION */
|
||||
void insertion(t_stacks *stacks, int len);
|
||||
int test2(char **argv);
|
||||
/* TEST FILE */
|
||||
int test1(int argc, char **argv);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* simple_headers.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: mteriier <mteriier@student.42lyon.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/01/07 07:47:59 by mteriier #+# #+# */
|
||||
/* Updated: 2026/01/07 07:48:02 by mteriier ### ########lyon.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
||||
71
main.c
71
main.c
@@ -11,81 +11,10 @@
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "push_swap.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void print_all_stack(t_stack *stack, t_stack *first, char pile)
|
||||
{
|
||||
t_stack *tmp;
|
||||
int i;
|
||||
|
||||
tmp = stack;
|
||||
i = 0;
|
||||
printf("TAB %c : \n", pile);
|
||||
if (!stack || !first)
|
||||
return ;
|
||||
while (tmp->next != first)
|
||||
{
|
||||
printf("[%d] ", tmp->value);
|
||||
tmp = tmp->next;
|
||||
i++;
|
||||
}
|
||||
printf("[%d] \n", tmp->value);
|
||||
}
|
||||
|
||||
int verif_no_double(int *tab, int len, int value)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (i < len)
|
||||
{
|
||||
if (value == tab[i])
|
||||
return (0);
|
||||
i++;
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
int adding_number(int *tab, int len)
|
||||
{
|
||||
int stock;
|
||||
|
||||
stock = tab[0];
|
||||
while (!verif_no_double(tab, len, stock))
|
||||
{
|
||||
stock = 0 + rand() % (250 - 0 + 1);
|
||||
}
|
||||
return (stock);
|
||||
}
|
||||
|
||||
int *auto_shuffle(int len_tab)
|
||||
{
|
||||
int *tab;
|
||||
int i;
|
||||
|
||||
i = 1;
|
||||
tab = malloc(len_tab * sizeof(int));
|
||||
if (!tab)
|
||||
return (NULL);
|
||||
tab[0] = 0 + rand() % (250 - 0 + 1);
|
||||
while (i < len_tab)
|
||||
{
|
||||
tab[i] = adding_number(tab, i - 1);
|
||||
i++;
|
||||
}
|
||||
return (tab);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (argc > 1)
|
||||
{
|
||||
if (strcmp(argv[1], "-t2") == 0)
|
||||
test2(argv++);
|
||||
else
|
||||
test1(argc, argv);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -11,9 +11,10 @@
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "push_swap.h"
|
||||
#include "parsing.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
t_stack *parsing(int argc, char **argv)
|
||||
static t_stack *parsing(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
int stock;
|
||||
|
||||
@@ -12,22 +12,8 @@
|
||||
|
||||
#include "push_swap.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void print_tabs(t_tab *preset)
|
||||
{
|
||||
t_tab *tab;
|
||||
|
||||
tab = preset;
|
||||
while (tab)
|
||||
{
|
||||
printf("MAX RANGE : [%d]\n", tab->max_range);
|
||||
printf("NUMBER IN : [%d]\n", tab->nb_in);
|
||||
tab = tab->next;
|
||||
}
|
||||
}
|
||||
|
||||
t_stack *parsing2(int *tab, int len)
|
||||
static t_stack *parsing2(int *tab, int len)
|
||||
{
|
||||
int i;
|
||||
int stock;
|
||||
|
||||
28
test_one.c
28
test_one.c
@@ -11,6 +11,8 @@
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "push_swap.h"
|
||||
#include "parsing.h"
|
||||
#include "medium_headers.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -33,29 +35,3 @@ int test1(int argc, char **argv)
|
||||
free(piles);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int test2(char **argv)
|
||||
{
|
||||
int *tab;
|
||||
int len;
|
||||
t_tab *preset;
|
||||
t_stacks *piles;
|
||||
|
||||
len = ft_atoi(argv[2]);
|
||||
if (len < 1)
|
||||
{
|
||||
printf("WRONG LEN PLS BE SMART.\n");
|
||||
return (0);
|
||||
}
|
||||
tab = auto_shuffle(len);
|
||||
piles = init_big_stacks2(tab, len);
|
||||
preset = get_tabs(piles->a, range_bucket(piles->a));
|
||||
bucket_algo(piles, preset, range_bucket(piles->a));
|
||||
free(tab);
|
||||
if (piles->a)
|
||||
stack_clear_all(piles->a, piles->a);
|
||||
if (piles->b)
|
||||
stack_clear_all(piles->b, piles->b);
|
||||
free(piles);
|
||||
return (0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user