This commit is contained in:
Timo Schmidt 2023-03-18 04:34:31 +01:00
parent d05faa6679
commit f7675d98df
2 changed files with 10 additions and 12 deletions

11
main.c
View File

@ -6,7 +6,7 @@
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */ /* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/18 02:09:32 by tischmid #+# #+# */ /* Created: 2023/03/18 02:09:32 by tischmid #+# #+# */
/* Updated: 2023/03/18 03:50:10 by tischmid ### ########.fr */ /* Updated: 2023/03/18 04:34:02 by tischmid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -23,19 +23,14 @@ int main(int argc, char *argv[])
if (argc != 3) if (argc != 3)
{ {
ft_putstr("Wrong number of arguments (expected 2 got "); ft_putstr("\033[31mWrong number of arguments (expected 2 got ");
ft_putnbr(argc - 1); ft_putnbr(argc - 1);
ft_putstr(")\n"); ft_putstr(")\033[m\n");
return (1); return (1);
} }
width = ft_atoi(argv[1]); width = ft_atoi(argv[1]);
height = ft_atoi(argv[2]); height = ft_atoi(argv[2]);
rush(width, height); rush(width, height);
// rush(5, 3);
// rush(5, 1);
// rush(1, 1);
// rush(1, 5);
// rush(4, 4);
return (0); return (0);
} }

View File

@ -6,7 +6,7 @@
/* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */ /* By: tischmid <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/18 02:10:24 by tischmid #+# #+# */ /* Created: 2023/03/18 02:10:24 by tischmid #+# #+# */
/* Updated: 2023/03/18 03:47:34 by tischmid ### ########.fr */ /* Updated: 2023/03/18 04:04:42 by tischmid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -46,7 +46,8 @@ void rush(int x, int y)
int i; int i;
i = 0; i = 0;
horiz_line(g_corners[0], g_horizontal, g_corners[1], x); if (y)
horiz_line(g_corners[0], g_horizontal, g_corners[1], x);
while (i++ < y - 2) while (i++ < y - 2)
horiz_line(g_vertical, g_inside, g_vertical, x); horiz_line(g_vertical, g_inside, g_vertical, x);
if (y > 1) if (y > 1)
@ -58,10 +59,12 @@ void horiz_line(char left, char middle, char right, int width)
int i; int i;
i = 0; i = 0;
ft_putchar(left); if (width)
ft_putchar(left);
while (i++ < width - 2) while (i++ < width - 2)
ft_putchar(middle); ft_putchar(middle);
if (width > 1) if (width > 1)
ft_putchar(right); ft_putchar(right);
ft_putchar('\n'); if (width)
ft_putchar('\n');
} }