mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-01-27 00:41:57 +00:00
starting the bonus and modify the name folder headers -> includes
This commit is contained in:
23
includes/check_error.h
Normal file
23
includes/check_error.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* check_error.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: mteriier <mteriier@student.42lyon.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/01/09 10:16:35 by mteriier #+# #+# */
|
||||
/* Updated: 2026/01/09 10:16:37 by mteriier ### ########lyon.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef CHECK_ERROR_H
|
||||
# define CHECK_ERROR_H
|
||||
|
||||
int verif_flag(char **tab, int mod);
|
||||
int check_error(char **tab, int mod);
|
||||
int verif_is_digit(char **tab, int mod);
|
||||
int verif_overflow(char **tab, int mod);
|
||||
int verif_double(char **tab, int mod);
|
||||
int scan_str_is_digit(char *tab);
|
||||
|
||||
#endif
|
||||
26
includes/flags.h
Normal file
26
includes/flags.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* flags.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: mteriier <mteriier@student.42lyon.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/01/07 13:05:52 by mteriier #+# #+# */
|
||||
/* Updated: 2026/01/08 15:32:54 by dgaillet ### ########lyon.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef FLAGS_H
|
||||
# define FLAGS_H
|
||||
|
||||
void simple(t_stacks *stacks);
|
||||
void medium(t_stacks *stacks);
|
||||
void complex(t_stacks *stacks);
|
||||
void adaptive(t_stacks *stacks, char **tab);
|
||||
void flags(int pos, int pos_b, char **argv, t_stacks *stacks);
|
||||
int pos_bench(char **argv, int mod);
|
||||
int pos_flag(char **argv, int mod);
|
||||
int calcul_mod(int argc, char **argv);
|
||||
void print_bench(t_stacks *stacks);
|
||||
|
||||
#endif
|
||||
41
includes/medium_headers.h
Normal file
41
includes/medium_headers.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* medium_headers.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: mteriier <mteriier@student.42lyon.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/01/07 07:47:49 by mteriier #+# #+# */
|
||||
/* Updated: 2026/01/07 07:47:51 by mteriier ### ########lyon.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef MEDIUM_HEADERS_H
|
||||
# define MEDIUM_HEADERS_H
|
||||
|
||||
typedef struct s_tab
|
||||
{
|
||||
int max_range;
|
||||
int nb_in;
|
||||
struct s_tab *next;
|
||||
} t_tab;
|
||||
|
||||
/* MEDIUM ALGO FILE */
|
||||
int wich_path(t_stacks *stacks, int max_range, int range, char c);
|
||||
int stack_len(t_stack *stack);
|
||||
void bucket_algo(t_stacks *stacks, t_tab *preset, int range);
|
||||
/* SORT UTILS FILES */
|
||||
void sort_from_left(t_stacks *stacks);
|
||||
void sort_from_right(t_stacks *stacks);
|
||||
void push_range_to_b(t_stacks *stacks, 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
|
||||
38
includes/parsing.h
Normal file
38
includes/parsing.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* parsing.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: mteriier <mteriier@student.42lyon.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/01/07 08:03:08 by mteriier #+# #+# */
|
||||
/* Updated: 2026/01/09 11:27:39 by dgaillet ### ########lyon.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef PARSING_H
|
||||
# define PARSING_H
|
||||
|
||||
# include <stdlib.h>
|
||||
# include "push_swap.h"
|
||||
|
||||
int ft_atoi(const char *nptr);
|
||||
int wich_mod(int mod);
|
||||
t_stacks *init_stacks(int argc, char **argv, int mod);
|
||||
int ft_strncmp(const char *s1, const char *s2, int n);
|
||||
size_t ft_strlen(const char *s);
|
||||
char *ft_substr(char const *s, unsigned int start, size_t len);
|
||||
char **ft_split(char const *s, char c);
|
||||
void free_tab(char **tab);
|
||||
int checker(int argc, char **argv);
|
||||
int len_split(char **tab);
|
||||
char *ft_itoa(int n);
|
||||
int ft_isdigit(int c);
|
||||
char *ft_strjoin(char const *s1, char const *s2);
|
||||
int ft_strlcpy(char *dst, const char *src, int size);
|
||||
int ft_strlcat(char *dst, const char *src, int size);
|
||||
char *join_all(int argc, char **argv);
|
||||
char **split_all(char *tab);
|
||||
float compute_disorder(char **strs, int pos);
|
||||
|
||||
#endif
|
||||
88
includes/push_swap.h
Normal file
88
includes/push_swap.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* push_swap.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/12/08 14:18:06 by dgaillet #+# #+# */
|
||||
/* Updated: 2026/01/08 15:32:04 by dgaillet ### ########lyon.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef PUSH_SWAP_H
|
||||
# define PUSH_SWAP_H
|
||||
|
||||
typedef struct s_stack
|
||||
{
|
||||
int value;
|
||||
struct s_stack *next;
|
||||
struct s_stack *previous;
|
||||
} t_stack;
|
||||
|
||||
typedef struct s_stacks
|
||||
{
|
||||
t_stack *a;
|
||||
t_stack *b;
|
||||
int algo;
|
||||
int bench;
|
||||
float disorder;
|
||||
unsigned int ra;
|
||||
unsigned int rb;
|
||||
unsigned int rr;
|
||||
unsigned int rra;
|
||||
unsigned int rrb;
|
||||
unsigned int rrr;
|
||||
unsigned int pa;
|
||||
unsigned int pb;
|
||||
unsigned int sa;
|
||||
unsigned int sb;
|
||||
unsigned int ss;
|
||||
} t_stacks;
|
||||
|
||||
/*STACK_FUNCTIONS*/
|
||||
void pa(t_stacks *stacks);
|
||||
void pb(t_stacks *stacks);
|
||||
void rra(t_stacks *stacks);
|
||||
void rrb(t_stacks *stacks);
|
||||
void rrr(t_stacks *stacks);
|
||||
void ra(t_stacks *stacks);
|
||||
void rb(t_stacks *stacks);
|
||||
void rr(t_stacks *stacks);
|
||||
void sa(t_stacks *stacks);
|
||||
void sb(t_stacks *stacks);
|
||||
void ss(t_stacks *stacks);
|
||||
/* 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);
|
||||
void free_all(t_stacks *stacks);
|
||||
/* STACKS LEN FILES */
|
||||
int stack_a_len(t_stacks *stacks);
|
||||
int stack_b_len(t_stacks *stacks);
|
||||
int highest_stack_len(t_stacks *stacks);
|
||||
/* PRE SORT */
|
||||
int r_to_lowest(t_stack *stack, int len);
|
||||
void sort_three_a(t_stacks *stacks);
|
||||
void sort_two(t_stacks *stacks);
|
||||
/* 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(char **tab, int len, int mod);
|
||||
|
||||
/* RADIX */
|
||||
void radix(t_stacks *stacks);
|
||||
|
||||
void secure_write(int fd, char *str, int len);
|
||||
void ft_putnbr_fd(int nbr, int fd);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user