	SUBROUTINE PROX(ID)
C	ROUTINE TO TELL DISTANCE TO CLOSEST 4 CRAWLERS
C	CRAWLERS MUST BE IN CUBE.
C----------------------standard common block----------------------------
C 
	COMMON ICR(8,12),IPARM(10),IS1,IS2,NT,ICU(10,10,10,2),CLEAR(8)
	COMMON MARKER(4,3,3)
	LOGICAL*1 ICU,CLEAR
C 
C-----------------------------------------------------------------------
	DIMENSION DIST(4),IDIST(4)
	LUN=ICR(ID,8)
	IE=ICR(ID,9)
	IF(IE.LT.1) GOTO 10  ! RETURN
	ICR(ID,9)=IE-1
	I0=ICR(ID,10)
	J0=ICR(ID,11)
	K0=ICR(ID,12)
	DO 1 I=1,4
	DIST(I)=99
	IDIST(I)=0 ! IF 0, NO CRAWLER...
1	CONTINUE
	DO 2 I=1,8
	IF(I.EQ.ID) GOTO 2
	IF(ICR(I,1).EQ.2.OR.ICR(I,1).EQ.4) GOTO 2
	I1=ICR(I,10)
	J1=ICR(I,11)
	K1=ICR(I,12)
	C=ICU(I1,J1,K1,1)
	IF(C.GT.'9'.AND.C.LT.'C') C=C-10 ! CRAWLER MAY BE ON DOORWAY
	IF(C-48.NE.I) GOTO 2  !  CRAWLER NOT IN CUBE OR DESTROYED
	X=(I0-I1)**2+(J0-J1)**2+(K0-K1)**2
	X=SQRT(X)
	IX=I
5	DO 3 J=1,4
	IF(X.LT.DIST(J)) GOTO 4
3	CONTINUE
	GOTO 2
4	Y=DIST(J)
	K=IDIST(J)
	DIST(J)=X
	IDIST(J)=IX
	X=Y
	IX=K
	GOTO 5
2	CONTINUE
C 
C	DIST/IDIST NOW CONTAIN FOUR CLOSEST DISTANCES AND CRAWLER ID'S
	WRITE(LUN,6)
6	FORMAT('0     distance        crawler      status')
	DO 8 K=1,4
	IF(IDIST(K).EQ.0) GOTO 8
	ST='    '
	IF(ICR(IDIST(K),1).LE.0) ST='  in'
	WRITE(LUN,7) DIST(K),IDIST(K),ST
8	CONTINUE
7	FORMAT(6X,F7.3,12X,I2,4X,A4,'active')
10	RETURN
	END
