adding a print_tetri function in print.c for testing

This commit is contained in:
Manzovince
2019-04-30 19:51:28 +02:00
parent 5dd491ed52
commit 7b26fc7feb
4 changed files with 32 additions and 286 deletions

29
print.c
View File

@@ -3,10 +3,10 @@
/* ::: :::::::: */
/* print.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
/* By: hulamy <hulamy@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/04/30 13:24:28 by hulamy #+# #+# */
/* Updated: 2019/04/30 13:25:18 by hulamy ### ########.fr */
/* Updated: 2019/04/30 19:26:01 by vmanzoni ### ########.fr */
/* */
/* ************************************************************************** */
@@ -31,6 +31,30 @@ void print_bits(unsigned int bits, int size)
write(1, "\n", 1);
}
/*
** DELETE BEFORE EVAL - TEST FUNCTION
** Prints a tetri from its bit form
*/
void print_tetri(unsigned int bits, int size)
{
unsigned int mask;
short i;
i = 0;
mask = 1 << (size - 1);
while (mask)
{
if (i % 4 == 0)
write(1, "\n", 1);
(bits & mask) ? write(1, "#", 1) : write(1, ".", 1);
write(1, " ", 1);
mask >>= 1;
i++;
}
write(1, "\n", 1);
}
/*
** DELETE BEFORE EVAL - TEST FUNCTION
** Print a map of height and width
@@ -56,4 +80,3 @@ void print_map(unsigned int *tab, int width, int height)
}
write(1, "\n", 1);
}