aboutsummaryrefslogtreecommitdiff
path: root/structs.h
blob: 5798b9e5433d25cafece02f06857d1bedfe38230 (plain) (blame)
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
#ifndef STRUCTS_H_
#define STRUCTS_H_

#include <stddef.h>

/* Top-left corner is x = 0, y = 0 */
struct Position_s {
    size_t x;
    size_t y;
};
typedef struct Position_s Position;

enum MapTile_e {
    EMPTY = 0,
    WALL = 255,
};
typedef enum MapTile_e MapTile;

enum Colors_e {
    EMPTY_COLOR = 1,
    VISITED_COLOR = 2,
    GOAL_COLOR = 3,
    WALL_COLOR = 4,
    START_COLOR = 5,
    PATH_COLOR = 6,
    FRONTIER_COLOR = 7,
    CURSOR_COLOR = 8, /* Used in path.c/anim() */
    WALL_TEXT_COLOR = 9,
};

/* A map is a 2D array of MapTiles.
 * Use as map[row][column] */
typedef MapTile** Map;

/* A path is a 2D array, in which for every tile we store the Position of a
 * tile we came from. To get the full path you have to follow it from end
 * to start */
typedef Position** Path;

#endif /* STRUCTS_H_ */