-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaze_solver.h
45 lines (39 loc) · 1.07 KB
/
maze_solver.h
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
#ifndef KS_MAZE_SOLVER
#define KS_MAZE_SOLVER
#define CLEAR_PIXEL 0xFF
#define HURDLE_PIXEL 0x00
#define PIXEL_BYTES 3
#define ERROPENINGS 1
#define ERRMEMORY 2
#define ERRSHPATH 4
// Type of each byte in the maze
typedef unsigned char maze_type;
struct maze_image
{
maze_type *data;
unsigned pixels;
unsigned width;
unsigned height;
unsigned char padding:2;
};
/**
* Solve the given maze by finding the shortest path from the start gate to the end gate.
*
* maze - a pointer to a 'struct maze_image' object containing the maze extracted from
* the BMP image.
* The data is expected to contain the padding that would usually be present
* in a BMP image.
*
* Colours:
* hurdle - black
* clear - white
*
* No other colours should be present.
*
* (width, height) - dimension of the BMP image
*
* Returns 0 on success and a non-zero value indicating the error on failure.
* Returns the solved maze in the input itself. Setting the path in a distinct color.
*/
int solve_maze(struct maze_image *const maze);
#endif