-
Notifications
You must be signed in to change notification settings - Fork 0
/
solve_tet_2.c
41 lines (38 loc) · 1.47 KB
/
solve_tet_2.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* solve_tet_2.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: akerkeb <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/01/21 23:15:08 by akerkeb #+# #+# */
/* Updated: 2016/01/21 23:41:34 by akerkeb ### ########.fr */
/* */
/* ************************************************************************** */
#include "fillit.h"
int ft_solve_tetri_plus(t_tetri *mainlist, char **final, int y, int x)
{
t_tetri *temp;
if ((temp = mainlist) != NULL && ft_test_isvalid(temp))
return (1);
while (temp != NULL)
{
while (final[y])
{
if (temp->is_valid == 0 && ft_test_2(temp, final, y, x))
{
ft_place(temp, final, y, x);
if (ft_solve_tetri_plus(mainlist, final, y, x))
return (1);
else
ft_unplace(temp, final, y, x);
}
x = (final[y][x] == '\n' && final[y]) ? -1 : x + 1;
y = (final[y][x] == '\n' && final[y]) ? y + 1 : y;
}
x = 0;
y = 0;
temp = temp->next;
}
return (0);
}