-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_placenreplace.c
42 lines (39 loc) · 1.35 KB
/
ft_placenreplace.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_placenreplace.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ohachim <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/22 13:06:45 by ohachim #+# #+# */
/* Updated: 2018/11/25 15:04:53 by magoumi ### ########.fr */
/* */
/* ************************************************************************** */
#include "header.h"
int ft_placenreplace(t_tet *tets, char **board, int size, int y)
{
int x;
int i;
x = -1;
i = 0;
while (++x < size)
{
y = -1;
while (++y < size)
{
if (ft_ispossible(tets[i].coor, board, x, y))
{
board = ft_place(tets[i], board, x, y);
if (tets[i + 1].l != '$')
{
if (ft_placenreplace(&tets[i + 1], board, size, -1))
return (1);
}
else
return (1);
}
board = ft_reset(tets[i].l, board);
}
}
return (0);
}