-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap.c
More file actions
28 lines (26 loc) · 988 Bytes
/
map.c
File metadata and controls
28 lines (26 loc) · 988 Bytes
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
#include "map.h"
#include "config.h"
// Map.
static const int map[MAPROWS][MAPCELLS] = {
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4},
{2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4},
{2, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 4},
{2, 0, 1, 0, 0, 0, 2, 0, 0, 1, 0, 0, 2, 0, 4},
{2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 4},
{2, 0, 0, 2, 2, 0, 2, 0, 2, 2, 0, 0, 2, 0, 4},
{2, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 2, 0, 4},
{2, 0, 0, 2, 0, 0, 3, 3, 0, 2, 0, 0, 2, 0, 4},
{2, 0, 0, 2, 2, 2, 3, 3, 2, 2, 2, 0, 2, 0, 4},
{2, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 2, 0, 4},
{2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0, 4},
{2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 4},
{2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 4},
{2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4},
{2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3}
};
int wall(int x, int y) {
if ((x >= 0 && x < MAPCELLS) && (y >= 0 && y < MAPROWS)) {
return map[y][x] > 0;
}
return 0;
}