}
/* Optimize the game end case where the outer frame is cleared */
- if (((gp[0] | gp[1] | gp[2]) & ~GOAL_MASK) == 0) {
- clear_border(display, game, sz);
- mask &= GOAL_MASK;
+ if (mask & GAME_MASK & ~GOAL_MASK) {
+ if (((gp[0] | gp[1] | gp[2]) & ~GOAL_MASK) == 0) {
+ clear_border(display, game, sz);
+ mask &= GOAL_MASK;
+ }
}
for (i = 0; i < 25; i++) {