This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ce4c08
commit 0440e4a
Showing
77 changed files
with
114 additions
and
1,999 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: tests macos | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: macos-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: mandatory tests | ||
run: cd push_swap; make; ./push_swap 1 2 3 4 5; | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: norminette | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
norminette_job: | ||
runs-on: ubuntu-latest | ||
name: norminette | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: alexandregv/norminette-action@v3 | ||
with: | ||
flags: './push_swap' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# **************************************************************************** # | ||
# # | ||
# ::: :::::::: # | ||
# Makefile :+: :+: :+: # | ||
# +:+ +:+ +:+ # | ||
# By: mahautlatinis <[email protected] +#+ +:+ +#+ # | ||
# +#+#+#+#+#+ +#+ # | ||
# Created: 2021/05/29 11:04:13 by user42 #+# #+# # | ||
# Updated: 2023/10/03 23:07:27 by mahautlatin ### ########.fr # | ||
# # | ||
# **************************************************************************** # | ||
|
||
SRCS_SORTER = ./srcs/sorter/main.c \ | ||
./srcs/sorter/short_suites/short_suites.c \ | ||
./srcs/sorter/long_suites/step1_target_index.c \ | ||
./srcs/sorter/long_suites/step2_keep_push.c \ | ||
./srcs/sorter/long_suites/step3_find_shortest_action.c \ | ||
./srcs/sorter/long_suites/step4_sort.c | ||
|
||
SRCS_COMMON = ./srcs/common/stack/stack_utils0.c \ | ||
./srcs/common/stack/stack_utils1.c \ | ||
./srcs/common/stack/stack_utils2.c \ | ||
./srcs/common/stack/stack_utils3.c \ | ||
./srcs/common/utils/utils0.c \ | ||
./srcs/common/actions/push_stack.c \ | ||
./srcs/common/actions/reverse_rotate_stack.c \ | ||
./srcs/common/actions/rotate_stack.c \ | ||
./srcs/common/actions/swap_stack.c \ | ||
./srcs/common/parsing/parsing_utils.c \ | ||
./srcs/common/exit/exit.c | ||
|
||
SRCS_CHECKER = ./srcs/checker_bonus/get_next_line.c \ | ||
./srcs/checker_bonus/get_next_line_utils.c \ | ||
./srcs/checker_bonus/main.c | ||
|
||
OBJS_SORTER = ${SRCS_SORTER:.c=.o} | ||
OBJS_COMMON = ${SRCS_COMMON:.c=.o} | ||
OBJS_CHECKER = ${SRCS_CHECKER:.c=.o} | ||
|
||
INCLUDE = ./srcs/include | ||
|
||
NAME = push_swap | ||
NAME_CHECKER = checker | ||
|
||
CC = gcc | ||
CFLAGS = -Wall -Wextra -Werror | ||
RM = rm -rf | ||
|
||
all: ${NAME} | ||
|
||
.c.o: | ||
${CC} ${CFLAGS} -I${INCLUDE} -c $< -o ${<:.c=.o} | ||
|
||
|
||
${NAME}: ${OBJS_COMMON} ${OBJS_SORTER} | ||
${CC} ${CFLAGS} -I${INCLUDE} -o ${NAME} ${OBJS_COMMON} ${OBJS_SORTER} | ||
|
||
${NAME_CHECKER}: ${OBJS_COMMON} ${OBJS_CHECKER} | ||
${CC} ${CFLAGS} -I${INCLUDE} -o ${NAME_CHECKER} ${OBJS_COMMON} ${OBJS_CHECKER} | ||
|
||
clean: | ||
${RM} ${OBJS_COMMON} ${OBJS_CHECKER} ${OBJS_SORTER} | ||
|
||
fclean: clean | ||
${RM} ${NAME} ${NAME_CHECKER} | ||
|
||
re: fclean all | ||
|
||
bonus: checker | ||
|
||
.PHONY: checker bonus all clean fclean re |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
Binary file not shown.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
/* ************************************************************************** */ | ||
/* */ | ||
/* ::: :::::::: */ | ||
/* step2.c :+: :+: :+: */ | ||
/* step2_keep_push.c :+: :+: :+: */ | ||
/* +:+ +:+ +:+ */ | ||
/* By: malatini <[email protected]> +#+ +:+ +#+ */ | ||
/* By: mahautlatinis <[email protected] +#+ +:+ +#+ */ | ||
/* +#+#+#+#+#+ +#+ */ | ||
/* Created: 2021/06/09 15:36:14 by malatini #+# #+# */ | ||
/* Updated: 2021/06/13 15:38:13 by malatini ### ########.fr */ | ||
/* Updated: 2023/10/03 23:09:20 by mahautlatin ### ########.fr */ | ||
/* */ | ||
/* ************************************************************************** */ | ||
|
||
#include <sorter/sorter.h> | ||
|
||
/* Compte la plus longue suite de target_index triés dans l'ordre croissant*/ | ||
/* Va renseigner keep a true si bool define est true */ | ||
int largest_keep_a(t_s_elem *start, t_stack *stack, bool define) | ||
{ | ||
t_s_elem *elem; | ||
|
@@ -43,7 +41,6 @@ int largest_keep_a(t_s_elem *start, t_stack *stack, bool define) | |
return (count); | ||
} | ||
|
||
/* Retourne l'adresse du premiere élément de la suite triée à garder sur A */ | ||
t_s_elem *get_max_keep(t_stack *stack) | ||
{ | ||
t_s_elem *elem; | ||
|
@@ -58,15 +55,14 @@ t_s_elem *get_max_keep(t_stack *stack) | |
cur = largest_keep_a(elem, stack, false); | ||
if (cur > max_keep) | ||
{ | ||
max_keep = cur; | ||
max = elem; | ||
max_keep = cur; | ||
max = elem; | ||
} | ||
elem = elem->next; | ||
} | ||
return (max); | ||
} | ||
|
||
/* Va determiner la plus longue suite d'index triés et mettre keep a true */ | ||
void set_keep(t_mem *mem) | ||
{ | ||
t_s_elem *max; | ||
|
@@ -77,7 +73,6 @@ void set_keep(t_mem *mem) | |
mem->maxsize = largest_keep_a(max, stack, true); | ||
} | ||
|
||
/* Mets sur la stack B tous ceux dont keep = false */ | ||
void push_keep_false_b(t_mem *mem) | ||
{ | ||
int size; | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.