31 #define RANDOM_OPTIONS 0
32 #define REGULAR_SPIRAL 1
35 #define MAX_SPIRAL_OPT 8
41 #define MIN(x, y) (((x) < (y)) ? (x) : (y))
44 #define MAX(x, y) (((x) < (y)) ? (y) : (x))
47 #define MAX_FINE .454545
49 extern int surround_check(
char **maze,
int i,
int j,
int xsize,
int ysize);
74 char **maze = (
char **)calloc(
sizeof(
char *), xsize);
76 for (i = 0; i < xsize; i++) {
77 maze[i] = (
char *)calloc(
sizeof(
char), ysize);
81 for (i = 0; i < xsize; i++)
82 for (j = 0; j < ysize; j++) {
113 float pitch = (
RANDOM()%5)/10.+10./22.;
115 xscale = yscale = pitch;
120 xscale *= (float)xsize/(
float)ysize;
122 yscale *= (float)ysize/(
float)xsize;
127 float scale =
MIN(xscale, yscale);
129 xscale = yscale = scale;
133 while ((fabsf(
x) < SizeX) && (fabsf(
y) < SizeY)) {
134 x = parm*cos(parm)*xscale;
135 y = parm*sin(parm)*yscale;
136 maze[(
int)(ic+
x)][(
int)(jc+
y)] =
'\0';
140 maze[(
int)(ic+
x+0.5)][(
int)(jc+
y+0.5)] =
'<';
143 maze[ic][jc+1] =
'>';
161 int i, j, ic = xsize/2, jc = ysize/2;
166 for (i = ic-1, j = jc; i > 0 &&
layout[i][j] ==
'#'; i--) {
170 for (i = ic+1, j = jc; i < xsize-1 &&
layout[i][j] ==
'#'; i++) {
178 for (i = ic, j = jc-1; j > 0 &&
layout[i][j] ==
'#'; j--) {
182 for (i = ic, j = jc+1; j < ysize-1 &&
layout[i][j] ==
'#'; j++) {
193 for (i = ic-1, j = jc/2; i > 0 &&
layout[i][j] ==
'#'; i--) {
198 for (i = ic+1, j = jc/2; i < xsize-1 &&
layout[i][j] ==
'#'; i++) {
203 for (i = ic/2, j = jc-1; j > 0 &&
layout[i][j] ==
'#'; j--) {
208 for (i = ic/2, j = jc+1; j < ysize-1 &&
layout[i][j] ==
'#'; j++) {
215 for (i = 0; i < xsize; i++)
216 for (j = 0; j < ysize; j++) {
217 if (
layout[i][j] ==
'D') {
219 if (si != 3 && si != 12) {