… | |
… | |
44 | /* decide snake orientation--vertical or horizontal , and |
44 | /* decide snake orientation--vertical or horizontal , and |
45 | make the walls and place the doors. */ |
45 | make the walls and place the doors. */ |
46 | |
46 | |
47 | if (rndm (2)) |
47 | if (rndm (2)) |
48 | { /* vertical orientation */ |
48 | { /* vertical orientation */ |
49 | int n_walls = RANDOM () % ((xsize - 5) / 3) + 1; |
49 | int n_walls = rndm (xsize - 5) / 3 + 1; |
50 | int spacing = xsize / (n_walls + 1); |
50 | int spacing = xsize / (n_walls + 1); |
51 | int orientation = 1; |
51 | int orientation = 1; |
52 | |
52 | |
53 | for (i = spacing; i < xsize - 3; i += spacing) |
53 | for (i = spacing; i < xsize - 3; i += spacing) |
54 | { |
54 | { |
… | |
… | |
71 | orientation ^= 1; /* toggle the value of orientation */ |
71 | orientation ^= 1; /* toggle the value of orientation */ |
72 | } |
72 | } |
73 | } |
73 | } |
74 | else |
74 | else |
75 | { /* horizontal orientation */ |
75 | { /* horizontal orientation */ |
76 | int n_walls = RANDOM () % ((ysize - 5) / 3) + 1; |
76 | int n_walls = rndm (ysize - 5) / 3 + 1; |
77 | int spacing = ysize / (n_walls + 1); |
77 | int spacing = ysize / (n_walls + 1); |
78 | int orientation = 1; |
78 | int orientation = 1; |
79 | |
79 | |
80 | for (i = spacing; i < ysize - 3; i += spacing) |
80 | for (i = spacing; i < ysize - 3; i += spacing) |
81 | { |
81 | { |