Page 875 - 2
P. 875

drawSquare(g, 0 + x * squareWidth(),
                                       boardTop + (BoardHeight - y - 1) * squareHeight(),
                                       curPiece.getShape());
                        }
                    }
                }


                private void dropDown()
                {
                    int newY = curY;
                    while (newY > 0) {
                        if (!tryMove(curPiece, curX, newY - 1))
                            break;
                        --newY;
                    }
                    pieceDropped();
                }


                private void oneLineDown()
                {
                    if (!tryMove(curPiece, curX, curY - 1))
                        pieceDropped();
                }


                private void clearBoard()
                {
                    for (int i = 0; i < BoardHeight * BoardWidth; ++i){
                        board[i] = Tetrominoes.NoShape;
                    }
                }
                private void pieceDropped()
                {
                    for (int i = 0; i < 4; ++i) {
                        int x = curX + curPiece.x(i);
                        int y = curY - curPiece.y(i);
                        board[(y * BoardWidth) + x] = curPiece.getShape();
                    }


                    removeFullLines();


                    if (!isFallingFinished)
                        newPiece();
                }


                private void newPiece()


                                                         - 875 -
   870   871   872   873   874   875   876   877   878   879   880