-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap.h
More file actions
50 lines (37 loc) · 1.25 KB
/
map.h
File metadata and controls
50 lines (37 loc) · 1.25 KB
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
/*
Written by William Sutherland for
COMP20007 Assignment 1 2023 Semester 1
Modified by Grady Fitzpatrick
Header for module which contains map-related
data structures and functions.
*/
#ifndef MAP_H
#define MAP_H
/* Data structure representing a point */
struct point {
int x;
int y;
};
/* Data structure representing a map */
struct map {
int **points;
int height;
int width;
};
/* Create a map of size length * width with values of 0 */
struct map *newMap(int height, int width);
/* Creates a new point with coordinates */
struct point *newPoint(int x, int y);
/* Frees the memory of the map */
void freeMap(struct map *m);
/* Prints the map */
void printMap(struct map *m);
/* Returns an array of points that are adjacent to the inputted point */
struct point *getAdjacentPoints(struct map *m, struct point *p);
/* Returns the total value of treasure from a map */
int mapValue(struct map *m);
/* Returns the minimum travel time between two points */
int minTime(struct map *m, struct point *start, struct point *end);
/* Returns the minimum travel time between two points for dry maps */
int minTimeDry(struct map *m, struct point *start, struct point *end, struct point *airports, int num_airports);
#endif