@@ -0,0 +1,1347 @@
+package tetris;%0A%0A/**%0A * Models the shadow projected on the board by a tetromino. Also used to calculate the%0A * score.%0A * %0A * @author dmayans%0A */%0A%0Aimport java.awt.Color;%0A%0Apublic class Shadow %7B%0A%0A%09private Board _board;%0A%09private int%5B%5D _currentX;%0A%09private int%5B%5D _currentY;%0A%09%0A%09public Shadow(int%5B%5D x, int%5B%5D y, Board board) %7B%0A%09%09_board = board;%0A%09%09_currentX = new int%5B4%5D;%0A%09%09_currentY = new int%5B4%5D;%0A%09%09// Sets up current position%0A%09%09for(int i=0; i%3C4; i++) %7B%0A%09%09%09_currentX%5Bi%5D = x%5Bi%5D;%0A%09%09%09_currentY%5Bi%5D = y%5Bi%5D;%0A%09%09%7D%0A%09%09while(this.moveDown()) %7B%7D // Sends the shadow as far down as possible%0A%09%09for(int i=0; i%3C4; i++) %7B%0A%09%09%09_currentY%5Bi%5D++; // The shadow will fall one tile too far since it doesn't%0A%09%09%09// use a separate array for future points. This corrects for that.%0A%09%09%7D%0A%09%7D%0A%09%0A%09// Similar, but significantly simplified, version of the Tetromino's move method.%0A%09public boolean moveDown() %7B%0A%09%09boolean flag = true;%0A%09%09for(int i=0; i%3C4; i++) %7B%0A%09%09%09_currentY%5Bi%5D--;%0A%09%09%09flag = flag && !_board.isOccupied(_currentX%5Bi%5D, _currentY%5Bi%5D);%0A%09%09%7D%0A%09%09return flag;%0A%09%7D%0A%09%0A%09// Called by its container to show the shadow%0A%09public void show() %7B%0A%09%09for(int i=0; i%3C4; i++) %7B%0A%09%09%09_board.paintBlock(_currentX%5Bi%5D, _currentY%5Bi%5D, Color.GRAY);%0A%09%09%7D%0A%09%7D%0A%09%0A%09// Called by its container to hide the shadow%0A%09public void hide() %7B%0A%09%09for(int i=0; i%3C4; i++) %7B%0A%09%09%09_board.darkenBlock(_currentX%5Bi%5D, _currentY%5Bi%5D);%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

Create Shadow.java