- for (i = 0; i < 4; i++) {
- uint_fast32_t this_mask, tmp;
- int this_count = 0;
-
- if (i & 2)
- this_mask = board_column(4*(i & 1));
- else
- this_mask = board_row(4*(i & 1));
-
- /* Count set bits */
- for (tmp = mask & this_mask; tmp; this_count++)
- tmp &= tmp - 1;
-
- if (this_count > best_count) {
- best_count = this_count;
- best_mask = this_mask;
- best = i;
- }
- }
-
- switch (best) {
- case 0: clear_tiles(state, display, d, 0, 0, 4, 0, w, h); break;
- case 1: clear_tiles(state, display, d, 0, 4, 4, 4, w, h); break;
- case 2: clear_tiles(state, display, d, 0, 0, 0, 4, w, h); break;
- case 3: clear_tiles(state, display, d, 4, 0, 4, 4, w, h); break;
- }
-
- clear_border(state, display, d, w, h, mask & ~best_mask);
+ clear_rect(state, display, d, 0, 0, 5*w, h);
+ clear_rect(state, display, d, 0, 4*h, 5*w, h);
+ clear_rect(state, display, d, 0, 0, w, 5*h);
+ clear_rect(state, display, d, 4*w, 0, w, 5*h);