/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* rush03.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: whaffman +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/06/08 11:57:11 by whaffman #+# #+# */ /* Updated: 2024/06/09 11:37:48 by whaffman ### ########.fr */ /* */ /* ************************************************************************** */ #define UL 'A' #define UR 'C' #define LL 'A' #define LR 'C' #define VW 'B' #define HW 'B' void ft_putchar(char c); void rush_char(int x, int y, \ int x_max, int y_max) { if (x == 1 && y == 1) ft_putchar(UL); else if ((y == 1 || y == y_max) && x != 1 && x != x_max) ft_putchar(HW); else if (y == 1 && x == x_max) ft_putchar(UR); else if ((x == 1 || x == x_max) && y != 1 && y != y_max) ft_putchar(VW); else if (x == 1 && y == y_max) ft_putchar(LL); else if (x == x_max && y == y_max) ft_putchar(LR); else ft_putchar(' '); } void rush(int x_max, int y_max) { int x; int y; if (x_max > 0 && y_max > 0) { y = 1; while (y <= y_max) { x = 1; while (x <= x_max) { rush_char(x, y, x_max, y_max); x++; } y++; ft_putchar('\n'); } } }