From bf24b5da9634551623c136d4d40f35bd38b299d5 Mon Sep 17 00:00:00 2001 From: kinou-p Date: Tue, 18 Jan 2022 22:43:43 +0100 Subject: [PATCH] done --- indexing.c | 37 -------------------------- process.c | 78 ------------------------------------------------------ 2 files changed, 115 deletions(-) delete mode 100644 indexing.c delete mode 100644 process.c diff --git a/indexing.c b/indexing.c deleted file mode 100644 index 47de8a0..0000000 --- a/indexing.c +++ /dev/null @@ -1,37 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* indexing.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: apommier +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2022/01/05 03:23:29 by apommier #+# #+# */ -/* Updated: 2022/01/05 03:23:29 by apommier ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "push_swap.h" - -void lst_indexing(t_list *list) -{ - int index; - t_list *swap; - t_list *save; - - swap = list; - save = list; - index = 0; - while (save) - { - index = 1; - while (swap) - { - if (*(int *)save->nbr > *(int *)swap->nbr) - index++; - swap = swap->next; - } - save->index = index; - swap = list; - save = save->next; - } -} diff --git a/process.c b/process.c deleted file mode 100644 index e7b5c83..0000000 --- a/process.c +++ /dev/null @@ -1,78 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* process.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: apommier +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2022/01/17 11:52:37 by apommier #+# #+# */ -/* Updated: 2022/01/17 11:52:37 by apommier ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "push_swap.h" - -void ft_sa_sb(t_list **list, t_slist **process, char type, int set) -{ - t_list *swap; - - swap = (*list)->next->next; - (*list)->next->next = *list; - *list = (*list)->next; - (*list)->next->next = swap; - if (set) - { - if (type == 'a') - s_lstadd_back(process, new_slist("sa")); - else if (type == 'b') - s_lstadd_back(process, new_slist("sb")); - } -} - -void ft_ra_rb(t_list **list, t_slist **process, char type) -{ - t_list *swap; - - swap = *list; - (ft_lstlast(*list))->next = *list; - *list = (*list)->next; - swap->next = 0; - if (type == 'a') - s_lstadd_back(process, new_slist("ra")); - else if (type == 'b') - s_lstadd_back(process, new_slist("rb")); -} - -t_list *ft_pa(t_list **list_a, t_list **list_b, t_slist **process) -{ - t_list *swap; - - swap = *list_b; - *list_b = (*list_b)->next; - ft_lstadd_front(list_a, swap); - s_lstadd_back(process, new_slist("pa")); - return (*list_b); -} - -void ft_pb(t_list **list_a, t_list **list_b, t_slist **process) -{ - t_list *swap; - - swap = *list_a; - *list_a = (*list_a)->next; - ft_lstadd_front(list_b, swap); - s_lstadd_back(process, new_slist("pb")); -} - -void ft_rra_rrb(t_list **list, t_slist **process, char type) -{ - t_list *swap; - - swap = ft_lstlast(*list); - ft_lstbeforelast(*list)->next = 0; - ft_lstadd_front(list, swap); - if (type == 'a') - s_lstadd_back(process, new_slist("rra")); - else if (type == 'b') - s_lstadd_back(process, new_slist("rrb")); -}