private Vector checkForPossibleMoves( int piecePosition, int pieceType,
					  Player aPlayer ) {
	
        
	Vector possibleMoves = new Vector();
	boolean adjacentSpace = false;
	Player player = aPlayer;
	
	// Get available moves if the piece is on a wall.
	possibleMoves.addAll( wallPieceMoves( piecePosition, false,
					      pieceType, player ) );
	
	// If the piece is a king.
  	if ( pieceType == theBoard.KING ) {
  	    // Check to see if piece is adjacent to piece of opposite color.
  	    // If there are, add possible end locations to vector.
  	    for ( int i = 0; i <= adjacentSpots.length; i++ ) {
  		adjacentSpace = theBoard.occupied( piecePosition
  						   + adjacentSpots[i] );
  		if ( !adjacentSpace ) {
  		    possibleMoves.addElement( new Integer( piecePosition +
  							   secondSpots[i] ) );	 
  		}
  	    } // end for
	    
  	} // end if (the piece is not a king).
	
  	// If the player's color is white it can only move up.
  	else if ( theBoard.getPieceAt( piecePosition ).getColor()
  		  == Color.white ) {
  	    for ( int j = 0; j <= 1; j++ ) {
  		adjacentSpace = theBoard.occupied( piecePosition 
  						   + adjacentSpots[j] );
  		// If the adjacent spot is empty.
  		if ( !adjacentSpace ) {
  		    possibleMoves.addElement( new Integer( piecePosition
  							   + secondSpots[j] ) ); 
  		}
  		adjacentSpace = false;
  	    } // end for
  	} 
  	// else the color is blue and can only move down.
  	else {
  	    for ( int k = 2; k <= adjacentSpots.length; k++ ) {
 		// Check to see if there are empty spots adjacent to piece.
  		adjacentSpace = theBoard.occupied( piecePosition 
  						   + adjacentSpots[k] );
  		// If there is an empty adjacent spot, add it to the 
  		// vector of possible moves.
  		if ( !adjacentSpace ) {
  		    possibleMoves.addElement( new Integer( piecePosition
  							   + secondSpots[k] ) );
  		}
  	    } // end for
  	} // end else
	
	return possibleMoves;
	
    }