File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed
Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ public class Board implements Grid {
1010
1111 private final int rows ;
1212 private final int columns ;
13- private final char [][] stationary ;
13+ private char [][] stationary ;
1414
1515 private Grid falling ;
1616 private int fallingBlockRow ;
@@ -93,16 +93,13 @@ private void startFalling(Grid piece) {
9393 }
9494
9595 private void stopFalling () {
96- for (int row = 0 ; row < falling .rows (); row ++) {
97- for (int col = 0 ; col < falling .columns (); col ++) {
98- char cell = falling .cellAt (row , col );
99- int boardRow = fallingBlockRow + row ;
100- int boardCol = fallingBlockColumn + col ;
101- if (cell != EMPTY && boardRow < this .rows ()) {
102- stationary [boardRow ][boardCol ] = cell ;
103- }
96+ char [][] newStationary = new char [rows ()][columns ()];
97+ for (int row = 0 ; row < rows (); row ++) {
98+ for (int col = 0 ; col < columns (); col ++) {
99+ newStationary [row ][col ] = cellAt (row , col );
104100 }
105101 }
102+ stationary = newStationary ;
106103 falling = null ;
107104 }
108105
You can’t perform that action at this time.
0 commit comments