-
Notifications
You must be signed in to change notification settings - Fork 0
/
fillit.c
51 lines (46 loc) · 1.4 KB
/
fillit.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fillit.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: magoumi <magoumi@1337.MA> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/08 11:15:47 by magoumi #+# #+# */
/* Updated: 2018/11/25 14:57:33 by magoumi ### ########.fr */
/* */
/* ************************************************************************** */
#include "header.h"
static int ft_gridsize(int size)
{
int n;
n = 0;
while (n * n < (size * 4))
n++;
return (n);
}
void fillit(char *file)
{
char **board;
t_tet *test;
int size;
size = 0;
if (!(test = ft_opend(file_open(file), 0)))
{
ft_putstr("error\n");
exit(0);
}
else
{
while (test[size].l != '$')
size++;
size = ft_gridsize(size);
board = set_grid();
init_grid(board, size);
while (ft_placenreplace(test, board, size, -1) == 0)
{
size++;
init_grid(board, size);
}
print_grid(board);
}
}