com.threerings.puzzle.drop.util
Interface PieceDropLogic


public interface PieceDropLogic

An interface to be implemented by games that would like to be able to drop their pieces during game play.


Method Summary
 boolean boardAlwaysFilled()
          Should the board always be filled?
 int getConstrainedEdge(DropBoard board, int col, int row, int dir)
          Returns the x-axis coordinate of the specified edge of the given constrained piece.
 boolean isClimbablePiece(boolean allowConst, int piece, boolean pre)
          Returns whether the given piece terminates a column climb when determining the height of a piece column to be dropped.
 boolean isConstrainedPiece(int piece)
          Returns whether the given piece has constraints upon it that impact its droppability.
 boolean isDroppablePiece(int piece)
          Returns whether the given piece is potentially droppable.
 

Method Detail

boardAlwaysFilled

boolean boardAlwaysFilled()
Should the board always be filled?

Returns:
false for normal behavior.

isDroppablePiece

boolean isDroppablePiece(int piece)
Returns whether the given piece is potentially droppable.


isConstrainedPiece

boolean isConstrainedPiece(int piece)
Returns whether the given piece has constraints upon it that impact its droppability.


isClimbablePiece

boolean isClimbablePiece(boolean allowConst,
                         int piece,
                         boolean pre)
Returns whether the given piece terminates a column climb when determining the height of a piece column to be dropped.

Parameters:
allowConst - whether to allow dropping constrained pieces (though only in the first encountered constrained block.)
piece - the piece to consider.
pre - whether the climbability check is being performed before the height is incremented, or after.

getConstrainedEdge

int getConstrainedEdge(DropBoard board,
                       int col,
                       int row,
                       int dir)
Returns the x-axis coordinate of the specified edge of the given constrained piece.

TODO: This should go away once the sword and sail games have standardized on WEST/EAST or BLOCK_LEFT/BLOCK_RIGHT to reference block edges.

Parameters:
board - the board to search.
col - the column of the constrained piece.
row - the row of the constrained piece.
dir - the edge direction to find; one of DirectionCodes.LEFT or DirectionCodes.RIGHT.