00001 #ifndef HEADER_SCHEMAGAMEGENERATOR
00002 #define HEADER_SCHEMAGAMEGENERATOR
00003
00009 #include <malloc.h>
00010 #include <stdio.h>
00011 #include <stdlib.h>
00012 #include <string.h>
00013 #include <assert.h>
00014 #include <math.h>
00015 #include <time.h>
00016 #include <stdbool.h>
00017 #include "define.h"
00018
00019
00020
00021
00022
00024 struct coordinates_data
00025 {
00026 unsigned int row;
00027 unsigned int col;
00028 };
00029
00030
00031 typedef struct coordinates_data coordinates;
00032
00034 struct possible_directions
00035 {
00036 unsigned int left;
00037 unsigned int right;
00038 unsigned int up;
00039 unsigned int down;
00040 };
00041
00042
00043 typedef struct possible_directions directions;
00044
00045
00046
00062 bool generateSchema( const char *filename,
00063 unsigned int numRow,
00064 unsigned int numCol,
00065 unsigned int difficult
00066 );
00067
00068
00075 bool check_generateSchema( const FILE *newSchemaFile,
00077 unsigned int difficult,
00078 unsigned int numRow,
00079 unsigned int numCol
00080 );
00081
00082
00087 char **gameMap_alloc_and_set( unsigned int numRow,
00088 unsigned int numCol
00089 );
00090
00091
00099 double create_routes( unsigned int difficult,
00100 unsigned int numRow,
00101 unsigned int numCol,
00102 char **gameMap
00103 );
00104
00105
00112 unsigned int get_denyArea( unsigned int difficult,
00113 unsigned int numDir,
00115 unsigned int startDir
00117 );
00118
00119
00127 unsigned int getRouteNumber( unsigned int difficult,
00128 unsigned int numRow,
00129 unsigned int numCol
00130 );
00131
00132
00136 directions set_number_of_available_cells( coordinates start,
00138 coordinates deny,
00140 unsigned int numRow,
00142 unsigned int numCol
00144 );
00145
00146
00153 unsigned int get_MaxRouteLen( unsigned int numRow,
00154 unsigned int numCol,
00155 coordinates start,
00156 coordinates door
00157 );
00158
00159
00164 unsigned int point_in_random_direction(
00165
00166 unsigned int avail_dir1,
00169 unsigned int avail_dir2,
00172 unsigned int start_dir ,
00174 unsigned int deny_area ,
00176 double *probability,
00178 const double LOW
00180 );
00181
00182
00187 void get_direction_from_point( unsigned int numRow,
00188 unsigned int numCol,
00189 unsigned int *currentRow,
00191 unsigned int *currentCol,
00193 double probabilityLeft,
00195 double probabilityUp
00196 );
00197
00198
00201 void increase_schema_difficult( char **Map,
00202 unsigned int numRow,
00203 unsigned int numCol
00204 );
00205
00206
00209 void save_schema_to_file( char **gameMap,
00210 unsigned int numRow,
00211 unsigned int numCol,
00212 FILE *newSchemaFile
00213 );
00214
00215
00216
00217
00218 #endif