-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaze.h
61 lines (54 loc) · 1.63 KB
/
maze.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* maze.h
* MazeCubeGen: maze cube generator
*
* Copyright (c) 2020-2021 Bryan Franklin. All rights reserved.
*/
#ifndef MAZE_H
#define MAZE_H
typedef struct maze_face {
int d1, d2;
int rows, cols;
char *cells;
} face_t;
int face_init(face_t *face, int *sizes, int d1, int d2);
int face_free(face_t *face);
int face_get_cell(face_t *face, int row, int col);
typedef int* position_t;
int position_init(position_t *pos, int dimensions);
int position_copy(position_t *dst, position_t *src, int dimensions);
int position_compare(position_t *pos1, position_t *pos2, int dimensions);
int position_free(position_t *pos);
typedef struct position_list {
int numDimensions;
int capacity;
int num;
position_t *positions;
} position_list_t;
typedef struct maze {
int numFaces;
int numDimensions;
int *dimensions;
int maxSegments;
int minPathLength;
position_t startPos;
position_t endPos;
position_list_t reachable;
position_list_t solution;
face_t *faces;
char pathSelMode;
} maze_t;
int maze_init_str(maze_t *maze, char *dimStr);
int maze_init(maze_t *maze, int numDimensions, int *sizes, char *options);
int maze_free(maze_t *maze);
void maze_set_segments(maze_t *maze, int segs);
void maze_set_path_length(maze_t *maze, int len);
int maze_pick_goals(maze_t *maze);
int maze_solve(maze_t *maze);
int maze_get_distance(maze_t *maze, position_t posA, position_t posB);
int maze_generate(maze_t *maze);
int maze_write(maze_t *maze, char *filename);
int maze_load(maze_t *maze, char *filename);
int maze_export_gv(maze_t *maze, char *filename);
int maze_metrics(maze_t *maze);
#endif /* MAZE_H */