… | |
… | |
30 | return; |
30 | return; |
31 | |
31 | |
32 | /* decide snake orientation--vertical or horizontal , and |
32 | /* decide snake orientation--vertical or horizontal , and |
33 | make the walls and place the doors. */ |
33 | make the walls and place the doors. */ |
34 | |
34 | |
35 | if (rndm (2)) |
35 | if (rmg_rndm (2)) |
36 | { /* vertical orientation */ |
36 | { /* vertical orientation */ |
37 | int n_walls = rndm (xsize - 5) / 3 + 1; |
37 | int n_walls = rmg_rndm (xsize - 5) / 3 + 1; |
38 | int spacing = xsize / (n_walls + 1); |
38 | int spacing = xsize / (n_walls + 1); |
39 | int orientation = 1; |
39 | int orientation = 1; |
40 | |
40 | |
41 | for (i = spacing; i < xsize - 3; i += spacing) |
41 | for (i = spacing; i < xsize - 3; i += spacing) |
42 | { |
42 | { |
… | |
… | |
58 | orientation ^= 1; /* toggle the value of orientation */ |
58 | orientation ^= 1; /* toggle the value of orientation */ |
59 | } |
59 | } |
60 | } |
60 | } |
61 | else |
61 | else |
62 | { /* horizontal orientation */ |
62 | { /* horizontal orientation */ |
63 | int n_walls = rndm (ysize - 5) / 3 + 1; |
63 | int n_walls = rmg_rndm (ysize - 5) / 3 + 1; |
64 | int spacing = ysize / (n_walls + 1); |
64 | int spacing = ysize / (n_walls + 1); |
65 | int orientation = 1; |
65 | int orientation = 1; |
66 | |
66 | |
67 | for (i = spacing; i < ysize - 3; i += spacing) |
67 | for (i = spacing; i < ysize - 3; i += spacing) |
68 | { |
68 | { |
… | |
… | |
84 | orientation ^= 1; /* toggle the value of orientation */ |
84 | orientation ^= 1; /* toggle the value of orientation */ |
85 | } |
85 | } |
86 | } |
86 | } |
87 | |
87 | |
88 | /* place the exit up/down */ |
88 | /* place the exit up/down */ |
89 | if (rndm (2)) |
89 | if (rmg_rndm (2)) |
90 | { |
90 | { |
91 | maze[1][1] = '<'; |
91 | maze[1][1] = '<'; |
92 | maze[xsize - 2][ysize - 2] = '>'; |
92 | maze[xsize - 2][ysize - 2] = '>'; |
93 | } |
93 | } |
94 | else |
94 | else |