-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.nfs.20051028.0314
100 lines (94 loc) · 1.62 KB
/
.nfs.20051028.0314
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#include "fillit.h"
//Zero out map array
void zero_map(t_map *map)
{
int i;
int j;
i = 0;
while (i < map->size)
{
j = 0;
while (j < map->size)
{
map->arr[i][j] = 0;
j++;
}
i++;
}
}
int solve(t_lst *tets, t_map *map)
{
int x;
int y;
x = 0;
while (tets->current->next != NULL && x < map->size)
{
y = 0;
while (y < map->size)
{
if (valid_set(tets->current, map, x, y))
{
set_tet(tets->current, map, x, y);
tets->current = tets->current->next;
print_map(map);
if (tets->current == NULL)
{
ft_putstr("does this work!!!?\n");
return (1);
}
}
y++;
}
x++;
}
return (0);
}
/* void solve(t_lst *list)
{
t_map *map;
int new_size;
// int x = 0;
// int y = 0;
int i = 0;
int j;
map = (t_map *)malloc(sizeof(t_map));
if (!map)
return ;
map = new_map(ceil_sqrt(list->size));
// print_map(map);
// int x = 0;
// int y = 0;
// ft_putchar('\n');
// print_map(map);
// if(valid_set(tets->head, map, x, y))
//set_tet(list->head, map, x, y);
//print_map(map);
list->current = list->head;
while (is_big_enough(map, list->current))
{
new_size = is_big_enough(map, list->current);
ft_bzero(map, sizeof(map));
map = new_map(new_size);
}
while (list->current != NULL)
{
while (i < map->size)
{
j = 0;
while (j < map->size)
{
if (!map->arr[i][j])
{
list->current->x = i;
list->current->y = j;
if (valid_set(list->current, map, list->current->x, list->current->y))
set_tet(list->current, map, list->current->x, list->current->y);
}
j++;
}
i++;
}
// zero_map(map);
list->current = list->current->next;
}
} */