1010 for Arduboy
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

loop: only auto-game_over() when there are no pieces left on deck

Choosing a piece that can't be placed shouldn't automatically end
the game, since other pieces on deck might be able to clear a row or
column that this piece can then fit in.

Also reset the game.{x,y} when move_to_clear() fails so the piece
isn't hanging off the edge of the board.

+5 -1
+5 -1
arduboy-1010.ino
··· 451 451 game.curshape = game.ondeck[game.ondecksel]; 452 452 game.ondeck[game.ondecksel] = 0; 453 453 454 - if (!move_to_clear(&shapes[game.curshape])) { 454 + if (!move_to_clear(&shapes[game.curshape]) && 455 + left_ondeck() == 0) { 455 456 game_over(); 456 457 return; 457 458 } ··· 625 626 for (game.x = 0; game.x <= BOARD_SIZE - s->width; game.x++) 626 627 if (shape_clear(s, game.x, game.y)) 627 628 return true; 629 + 630 + /* make sure we're not hanging off the bottom corner of the board */ 631 + game.x = game.y = 0; 628 632 629 633 return false; 630 634 }