mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-11-01 08:12:03 +01:00
adding other files cause i put the git on the wrong
This commit is contained in:
1 parent
2b255b94da
commit
ca732b1b97
13 files changed
+31
-126
No files matched your search
@@ -59,3 +59,6 @@ dkms.conf
|
||||
|
||||
# Executable
|
||||
pushswap
|
||||
|
||||
# File obj
|
||||
obj/
|
||||
@@ -1,29 +1,45 @@
|
||||
#============================
|
||||
# ALL FOLDERS
|
||||
#============================
|
||||
|
||||
STACK_UTILS_DIR = stack_utils
|
||||
|
||||
ALGO_UTILS_DIR = algorithms/utils
|
||||
|
||||
ALGO_DIR = algorithms
|
||||
|
||||
MEDIUM_DIR = medium_utils
|
||||
PARS_DIR = parsing
|
||||
|
||||
SRC = main.c ft_atoi.c parsing.c parsing_2.c test_one.c
|
||||
MEDIUM_DIR = medium
|
||||
|
||||
INCLUDES = headers
|
||||
|
||||
#============================
|
||||
# ALL FILES WITHOUT PATH
|
||||
#============================
|
||||
|
||||
SRC = main.c test_one.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
|
||||
|
||||
ALGO_SORT = medium_algo.c
|
||||
|
||||
MEDIUM_ALGO = utils_medium.c utils_struct_tab.c utils_medium_two.c sort_utils.c sort_utils_two.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
|
||||
|
||||
ALL_FILES = $(SRC) $(STACK_UTILS_DIR)/$(STACK_UTILS) $(ALGO_DIR)/$(ALGO_SORT) \
|
||||
#============================
|
||||
# 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)
|
||||
|
||||
OBJ_DIR = obj
|
||||
|
||||
CC = cc
|
||||
|
||||
CFLAGS = -Wall -Werror -Wextra -I.
|
||||
CFLAGS = -Wall -Werror -Wextra -I $(INCLUDES)
|
||||
|
||||
NAME = push_swap
|
||||
|
||||
@@ -43,6 +59,9 @@ $(NAME): $(OBJ)
|
||||
$(OBJ_DIR)/%.o: %.c | $(OBJ_DIR)
|
||||
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
|
||||
|
||||
$(OBJ_DIR)/%.o: $(PARS_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 $@
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "push_swap.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
int path_to_end(t_stacks *piles, int max_range, int range, char c)
|
||||
static int path_to_end(t_stacks *piles, int max_range, int range, char c)
|
||||
{
|
||||
t_stack *tmp;
|
||||
int i;
|
||||
@@ -37,7 +37,7 @@ int path_to_end(t_stacks *piles, int max_range, int range, char c)
|
||||
return (i);
|
||||
}
|
||||
|
||||
int path_to_start(t_stacks *piles, int max_range, int range, char c)
|
||||
static int path_to_start(t_stacks *piles, int max_range, int range, char c)
|
||||
{
|
||||
t_stack *tmp;
|
||||
int i;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
-117
@@ -1,117 +0,0 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* push_swap.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: dgaillet <dgaillet@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/12/08 14:18:06 by dgaillet #+# #+# */
|
||||
/* Updated: 2025/12/15 14:34:45 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;
|
||||
} t_stacks;
|
||||
|
||||
typedef struct s_tab
|
||||
{
|
||||
int max_range;
|
||||
int nb_in;
|
||||
struct s_tab *next;
|
||||
} t_tab;
|
||||
|
||||
/*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);
|
||||
|
||||
/*FUNCTION UTILS*/
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
void insertion(t_stacks *stacks, int len);
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user