forked from xiexun162534/Labyrinth
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate.h
More file actions
36 lines (22 loc) · 836 Bytes
/
generate.h
File metadata and controls
36 lines (22 loc) · 836 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
29
30
31
32
33
34
35
36
#ifndef __GENERATE_H
#define __GENERATE_H
#define CHECKED 100
#define PROBABILITY_CONTINUE_FORKING 0.85
#define PROBABILITY_GO_AHEAD 0.9
#define PROBABILITY_GO_BACK 0.1
typedef struct __ROAD
{
int length;
coordinate *list;
} road;
map *generate (int width, int height, coordinate entrance_position, coordinate exit_position);
void generate_main_road (map *labyrinth);
void generate_branches_along (map *labyrinth, road current_road);
int go_ahead (map *labyrinth, road *current_road_p, coordinate *current_position_p);
int go_back (map *labyrinth, road *current_road_p, coordinate *current_position_p);
void generate_walls_around (map *labyrinth, coordinate position);
void clean_checked (map *labyrinth);
int get_random_direction ();
void reset_random_direction ();
int probability_event (double probability);
#endif