44 char **maze = (
char **)calloc(
sizeof(
char *), xsize);
45 for (i = 0; i < xsize; i++) {
46 maze[i] = (
char *)calloc(
sizeof(
char), ysize);
50 for (i = 0; i < xsize; i++) {
51 maze[i][0] = maze[i][ysize-1] =
'#';
53 for (j = 0; j < ysize; j++) {
54 maze[0][j] = maze[xsize-1][j] =
'#';
58 if (xsize < 8 || ysize < 8) {
66 int n_walls =
RANDOM()%((xsize-5)/3)+1;
67 int spacing = xsize/(n_walls+1);
70 for (i = spacing; i < xsize-3; i += spacing) {
72 for (j = 1; j < ysize-2; j++) {
77 for (j = 2; j < ysize; j++) {
85 int n_walls =
RANDOM()%((ysize-5)/3)+1;
86 int spacing = ysize/(n_walls+1);
89 for (i = spacing; i < ysize-3; i += spacing) {
91 for (j = 1; j < xsize-2; j++) {
96 for (j = 2; j < xsize; j++) {
108 maze[xsize-2][ysize-2] =
'>';
111 maze[xsize-2][ysize-2] =
'<';