+/* alternate between horizontal and vertical slides */
+/* note that dir specifies the direction the _hole_ moves, not the tiles */
+ if (last == VERTICAL) {
+ if ((rnd = random () % (grid_w - 1)) < hole_x) {
+ dx = -1; dir = LEFT; hole_x -= rnd;
+ } else {
+ dx = 1; dir = RIGHT; rnd -= hole_x;
+ }
+ dy = 0; w = size = rnd + 1; h = 1;
+ last = HORIZONTAL;
+ } else {
+ if ((rnd = random () % (grid_h - 1)) < hole_y) {
+ dy = -1; dir = UP; hole_y -= rnd;
+ } else {
+ dy = 1; dir = DOWN; rnd -= hole_y;
+ }
+ dx = 0; h = size = rnd + 1; w = 1;
+ last = VERTICAL;
+ }
+