Tetris 2 ------------------------------------------------ Functionality: 80 ------------------------------------------------ the height[] widths and maxheight are update properly 10 basically the top/horizon line should appear green in JBoardTEst place() 10 This takes a piece, and an (x,y), and sets the piece into the grid with the origin (the lower-left corner) of the piece at that location in the board. The undo() operation (below) can remove the most recently placed piece. Return value: returns PLACE_OK for a successful placement. Returns PLACE_ROW_FILLED for a successful placement that also caused at least one row to become filled. clearRows() 20 This method deletes each row that is filled all the way across, causing things above to shift down. New rows shifted in at the top of the board should be empty. There may be multiple filled rows, and they may not be adjacent. The perfect solution does everything in one pass. update heights[]. update widths[]. update maxHeight dropHeight() 20 computes the y value where the origin (0,0) of a piece will come to rest if dropped in the given column from infinitely high. Drop height should use the heights[] array and the skirt of the piece to compute the y value quickly, in O(piece-width) time. DropHeight() assumes the piece falls straight down -- it does not account for moving the piece around things during the drop. the Undo mechanism 20 place() and clearRows() operations copy the main state to the backup before making changes: that is, copies the board, widths[] and heights[]. The simplest strategy is to just backup all the columns when place() happens. This is an acceptable strategy. In this case, no further backup is required for clearRows(), since place() already backed up the whole grid. undo() restores the main state from the backup: swat the backup and the main states. ------------------------------------------------ Style and structure: 20 ------------------------------------------------ easy to read and understand and verify overall correctness of the underlying logic. Did not modify any otehr function to get things to work sanityCheck() needs to be implemented and used for debugging (points will not be taken off for this only in the case the program works perfectly)