-
Notifications
You must be signed in to change notification settings - Fork 0
/
gride.c
64 lines (57 loc) · 1.45 KB
/
gride.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
52
53
54
55
56
57
58
59
60
61
62
63
64
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* gride.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: magoumi <magoumi@1337.MA> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/16 10:43:08 by magoumi #+# #+# */
/* Updated: 2018/11/25 15:00:56 by magoumi ### ########.fr */
/* */
/* ************************************************************************** */
#include "header.h"
char **set_grid(void)
{
char **grid;
int i;
i = 0;
grid = malloc(sizeof(char *) * 16);
while (i < 16)
{
grid[i] = malloc(16);
grid[i] = ft_memset(grid[i], '$', 15);
grid[i][15] = 0;
i++;
}
return (grid);
}
void init_grid(char **grid, int size)
{
int i;
int j;
i = 0;
while (i < size)
{
j = 0;
while (j < size)
{
grid[i][j] = '.';
j++;
}
i++;
}
}
void print_grid(char **grid)
{
int i;
int j;
i = 0;
while (grid[i][0] != '$')
{
j = 0;
while (grid[i][j] != '$')
ft_putchar(grid[i][j++]);
ft_putchar('\n');
i++;
}
}