adding makefile and debugging to try new test for the preset to test the program

This commit is contained in:
Maoake
2025-12-10 21:02:33 +00:00
parent b6c1dc73a8
commit 5372b944a4
11 changed files with 78 additions and 24 deletions

View File

@@ -34,14 +34,14 @@ int get_next_lower(t_stack *first, int old_lower)
int next_lower;
tmp = first;
lower = tmp->value;
next_lower = tmp->value;
while (tmp->next != first)
{
if (tmp->value != old_lower && lower < tmp->value)
lower = tmp->value;
if (tmp->value != old_lower && next_lower < tmp->value)
next_lower = tmp->value;
tmp = tmp->next;
}
return (lower);
return (next_lower);
}
int calcul_range(int value, int range)
@@ -70,14 +70,14 @@ int in_range(int value, int max_range)
return (0);
}
int get_number_in_range(int range, t_stacks *piles)
int get_number_in_range(int range, t_stack *a)
{
int nb_in;
t_stack *tmp;
t_stack *first;
nb_in = 0;
tmp = piles->a;
tmp = a;
first = tmp;
while (tmp->next != first)
{

View File

@@ -11,15 +11,16 @@
/* ************************************************************************** */
#include "push_swap.h"
#include <stdlib.h>
t_tab *allocate_tab(int range_max, int nb)
{
t_tab tab;
t_tab *tab;
tab = malloc(sizeof(t_tab));
if (!tab)
return (NULL);
tab->range_max = range_max;
tab->max_range = range_max;
tab->nb_in = nb;
return (tab);
}
@@ -32,10 +33,10 @@ t_tab *get_tabs(t_stack *first)
int scan_nb_in_tab;
len_stack = stack_len(first);
first_tab = first_tab(first);
first_tab = init_first_tab(first);
if (!first_tab)
return (NULL);
scan_nb_in_tab = tab->nb_in;
scan_nb_in_tab = first_tab->nb_in;
tmp = first_tab;
while (scan_nb_in_tab < len_stack)
{
@@ -48,7 +49,7 @@ t_tab *get_tabs(t_stack *first)
return (first_tab);
}
t_tab *first_tab(t_stack *first)
t_tab *init_first_tab(t_stack *first)
{
t_tab *tab;
int lower;
@@ -62,7 +63,7 @@ t_tab *first_tab(t_stack *first)
return (tab);
}
t_tab *get_next_tab(t_stack *first, t_tab tab)
t_tab *get_next_tab(t_stack *first, t_tab *tab)
{
int lower;
int range_max;