adding the flags

This commit is contained in:
Maoake Teriierooiterai
2026-01-07 13:13:30 +01:00
parent 0d9b46c748
commit 93e8c10b27
8 changed files with 134 additions and 1 deletions

42
flags/algorithms_sort.c Normal file
View File

@@ -0,0 +1,42 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* algorithms_sort.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mteriier <mteriier@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/07 12:15:02 by mteriier #+# #+# */
/* Updated: 2026/01/07 12:15:05 by mteriier ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
#include "medium_algo.h"
void simple(t_stacks *piles)
{
int len;
len = stack_a_len(piles);
insertion(piles, len);
}
void medium(t_stacks *piles)
{
t_tab *buckets;
int range;
range = range_bucket(piles->a);
buckets = get_tabs(piles->a, range);
bucket_algo(piles, buckets, range);
}
void complex(t_stacks *piles)
{
return ;
}
void adaptive(t_stacks *piles)
{
return ;
}

29
flags/flag.c Normal file
View File

@@ -0,0 +1,29 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* flag.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mteriier <mteriier@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/07 12:39:29 by mteriier #+# #+# */
/* Updated: 2026/01/07 12:39:31 by mteriier ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
#include "parsing.h"
void flags(int pos, char **argv, t_stacks *piles)
{
if (ft_strncmp(argv[pos], "--simple", 30) && pos > 0)
simple(piles);
else if (ft_strncmp(argv[pos], "--medium", 30) && pos > 0)
medium(piles);
else if (ft_strncmp(argv[pos], "--complex", 30) && pos > 0)
complex(piles);
else if (ft_strncmp(argv[pos], "--adaptive", 30) && pos > 0)
adaptive(piles);
else
adaptive(piles);
}