|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectOOPI.tetris.Tetris
Tetris - This is the skeleton solution for the Tetris game. The four methods of TetrisLogic must all be implemented properly to play the manual and automatic versions of Tetris properly.
TetrisFrame
,
TetrisLogic
,
Cell
,
Position
Constructor Summary | |
Tetris()
|
Method Summary | |
Cell[][] |
collapseRows(Cell[][] board)
Returns a new board based on the specified board where all rows that are completely filled are collapsed with higher rows falling down to replace collapsed rows. |
double |
computeMoveQuality(Cell[][] board,
Cell[][] piece,
Position position,
Cell[][] nextPiece)
Computes a measure of quality for the specified piece and position where larger values are better. |
boolean |
isLegalPosition(Cell[][] board,
Cell[][] piece,
Position position)
Determines if the specified piece is in a legal position. |
static void |
main(java.lang.String[] args)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Tetris()
Method Detail |
public static void main(java.lang.String[] args)
public boolean isLegalPosition(Cell[][] board, Cell[][] piece, Position position)
TetrisLogic
isLegalPosition
in interface TetrisLogic
board
- The current game board statepiece
- The new piece for which position legality is being computedposition
- The position of the new piece
public Cell[][] collapseRows(Cell[][] board)
TetrisLogic
collapseRows
in interface TetrisLogic
board
- The current game board state
public double computeMoveQuality(Cell[][] board, Cell[][] piece, Position position, Cell[][] nextPiece)
TetrisLogic
computeMoveQuality
in interface TetrisLogic
board
- The current game board statepiece
- The new piece for which position quality is being computedposition
- The position of the new piecenextPiece
- The piece that will be used after this one.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |