24 char **maze = (
char **)calloc(
sizeof(
char *), xsize);
25 for (i = 0; i < xsize; i++) {
26 maze[i] = (
char *)calloc(
sizeof(
char), ysize);
30 for (i = 0; i < xsize; i++)
31 maze[i][0] = maze[i][ysize-1] =
'#';
32 for (j = 0; j < ysize; j++)
33 maze[0][j] = maze[xsize-1][j] =
'#';
36 if (xsize < 8 || ysize < 8)
43 int n_walls = RANDOM()%((xsize-5)/3)+1;
44 int spacing = xsize/(n_walls+1);
47 for (i = spacing; i < xsize-3; i += spacing) {
49 for (j = 1; j < ysize-2; j++) {
54 for (j = 2; j < ysize; j++) {
62 int n_walls = RANDOM()%((ysize-5)/3)+1;
63 int spacing = ysize/(n_walls+1);
66 for (i = spacing; i < ysize-3; i += spacing) {
68 for (j = 1; j < xsize-2; j++) {
73 for (j = 2; j < xsize; j++) {
85 maze[xsize-2][ysize-2] =
'>';
88 maze[xsize-2][ysize-2] =
'<';
char ** make_snake_layout(int xsize, int ysize)