From b5c71a6b2cb6c2549535775125ec5f2cc8ed8e36 Mon Sep 17 00:00:00 2001 From: Juan Bosco Torrez Castillo Date: Sat, 18 Mar 2023 20:24:08 +0100 Subject: [PATCH] Production ready --- main.c | 47 +++----------------------------------------- rush0X.c => rush00.c | 29 ++++----------------------- 2 files changed, 7 insertions(+), 69 deletions(-) rename rush0X.c => rush00.c (63%) diff --git a/main.c b/main.c index 879aa66..fa55b48 100644 --- a/main.c +++ b/main.c @@ -3,17 +3,14 @@ /* ::: :::::::: */ /* main.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: tischmid +#+ +:+ +#+ */ +/* By: jtorrez- +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ -/* Created: 2023/03/18 02:09:32 by tischmid #+# #+# */ -/* Updated: 2023/03/18 04:52:15 by tischmid ### ########.fr */ +/* Created: 2023/03/18 20:15:26 by jtorrez- #+# #+# */ +/* Updated: 2023/03/18 20:21:42 by jtorrez- ### ########.fr */ /* */ /* ************************************************************************** */ void rush(int x, int y); -void ft_putchar(char c); -void ft_putstr(char *str); -void ft_putnbr(int nb); int ft_atoi(char *str); int main(int argc, char *argv[]) @@ -22,51 +19,13 @@ int main(int argc, char *argv[]) int height; if (argc != 3) - { - ft_putstr("\033[31mWrong number of arguments (expected 2 got "); - ft_putnbr(argc - 1); - ft_putstr(")\033[m\n"); - ft_putstr("\033[32mUsage: ./rush00 [width] [height]\033[m\n"); return (1); - } width = ft_atoi(argv[1]); height = ft_atoi(argv[2]); rush(width, height); return (0); } -void ft_putstr(char *str) -{ - int i; - - i = 0; - while (str[i] != 0) - ft_putchar(str[i++]); -} - -void ft_putnbr(int nb) -{ - char last_digit; - - if (nb < 0) - { - ft_putchar('-'); - if (nb == 1 << 31) - { - nb += 2e9; - ft_putchar('2'); - } - nb *= -1; - } - last_digit = nb % 10 + '0'; - if (nb > 9) - { - nb /= 10; - ft_putnbr(nb); - } - ft_putchar(last_digit); -} - int ft_atoi(char *str) { int i; diff --git a/rush0X.c b/rush00.c similarity index 63% rename from rush0X.c rename to rush00.c index 989f462..e921216 100644 --- a/rush0X.c +++ b/rush00.c @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* rush0X.c :+: :+: :+: */ +/* rush00.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: tischmid +#+ +:+ +#+ */ +/* By: jtorrez- +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ -/* Created: 2023/03/18 02:10:24 by tischmid #+# #+# */ -/* Updated: 2023/03/18 19:48:04 by jtorrez- ### ########.fr */ +/* Created: 2023/03/18 20:15:12 by jtorrez- #+# #+# */ +/* Updated: 2023/03/18 20:15:17 by jtorrez- ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,32 +15,11 @@ void horiz_line(char left, char middle, char right, int width); const char g_inside = ' '; -// Rush 00 // clockwise, starting from top left const char g_corners[] = {'o', 'o', 'o', 'o', '\0'}; const char g_horizontal = '-'; const char g_vertical = '|'; -// Rush 01 -// const char g_corners[] = {'/', '\\', '/', '\\', '\0'}; -// const char g_horizontal = '*'; -// const char g_vertical = '*'; - -// Rush 02 -// const char g_corners[] = {'A', 'A', 'C', 'C', '\0'}; -// const char g_horizontal = 'B'; -// const char g_vertical = 'B'; - -// Rush 03 -// const char g_corners[] = {'A', 'C', 'C', 'A', '\0'}; -// const char g_horizontal = 'B'; -// const char g_vertical = 'B'; - -// Rush 04 -// const char g_corners[] = {'A', 'C', 'A', 'C', '\0'}; -// const char g_horizontal = 'B'; -// const char g_vertical = 'B'; - void rush(int x, int y) { int i;