rush04.c
This commit is contained in:
parent
2ea1890e40
commit
60af4cd1d8
|
@ -0,0 +1,49 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* rush04.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: jtorrez- <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/03/18 20:15:12 by jtorrez- #+# #+# */
|
||||||
|
/* Updated: 2023/03/19 02:24:30 by tischmid ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "include/ft_putchar.h"
|
||||||
|
#include "include/ft_lib.h"
|
||||||
|
#include "include/rush0X.h"
|
||||||
|
|
||||||
|
const char g_inside = ' ';
|
||||||
|
|
||||||
|
// corners specified clockwise, starting from top left
|
||||||
|
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;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
if (x * y == 0)
|
||||||
|
return ;
|
||||||
|
horiz_line(g_corners[0], g_horizontal, g_corners[1], x);
|
||||||
|
while (i++ < y - 2)
|
||||||
|
horiz_line(g_vertical, g_inside, g_vertical, x);
|
||||||
|
if (y > 1)
|
||||||
|
horiz_line(g_corners[3], g_horizontal, g_corners[2], x);
|
||||||
|
}
|
||||||
|
|
||||||
|
void horiz_line(char left, char middle, char right, int width)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
ft_putchar(left);
|
||||||
|
while (i++ < width - 2)
|
||||||
|
ft_putchar(middle);
|
||||||
|
if (width > 1)
|
||||||
|
ft_putchar(right);
|
||||||
|
ft_putchar('\n');
|
||||||
|
}
|
Loading…
Reference in New Issue