@Override
	public void onClick(Position position)
	{
		if (board == null)
		{
			return;
		}

		if (!board.isEmpty(position) && board.getPiece(position).getColor() == playerColor)
		{
			if (selectedPosition == position)
			{
				selectedPosition = null;
				gui.clearReachablity();
				return;
			}
			possibleMoves = MoveHelper.getAllMoves4Piece(board, position, false);
			if (!possibleMoves.isEmpty())
			{
				gui.clearReachablity();
				selectedPosition = position;
				gui.setReachablity(possibleMoves);
			}
		}
		else if (selectedPosition == null)
		{
			return;
		}
		else
		{
			for (Move m : possibleMoves)
			{
				if (m.getDestPosition() == position)
				{
					gui.clearReachablity();
					move = m;
					synchronized (this)
					{
						notifyAll();
					}
					return;
				}
			}

		}

	}