	SUBROUTINE ROTATE(W,ID)
C	ROUTINE TO ROTATE CRAWLERS
C	W IS THE 'WAY' TO ROTATE (L,R,U,D)
C	ID IS THE CRAWLER ID
C 
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-----------------------------------------------------------------------
	LOGICAL*1 W
	IC=ID
	IF(ID.LT.0) ID=-ID
	LUN=ICR(ID,8)
	IE=ICR(ID,9)
	IF(IE.LT.2) GOTO 7
	IF(W.EQ.'L') GOTO 1
	IF(W.EQ.'R') GOTO 2
	IF(W.EQ.'U') GOTO 3
	IF(W.EQ.'D') GOTO 4
	IF(ICR(ID,1).LT.3.OR.IPARM(1).EQ.0) WRITE(LUN,100) W
100	FORMAT(' [',A1,'] invalid direction')
	GOTO 99
6	ICR(ID,9)=IE-2   !  DEPLETE ENERGY
	IF(IC.GE.0.AND.(ICR(ID,1).LT.3.OR.IPARM(1).EQ.0)) WRITE(LUN,98)
98	FORMAT(' ...........click..........whir.........')
99	RETURN
1	I=ICR(ID,2)  !  LEFT TURN
	ICR(ID,2)=ICR(ID,3)
	ICR(ID,3)=ICR(ID,4)
	ICR(ID,4)=ICR(ID,5)
	ICR(ID,5)=I
	GOTO 6
2	I=ICR(ID,2)   !  RIGHT TURN
	ICR(ID,2)=ICR(ID,5)
	ICR(ID,5)=ICR(ID,4)
	ICR(ID,4)=ICR(ID,3)
	ICR(ID,3)=I
	GOTO 6
3	I=ICR(ID,2)   !  UP
	ICR(ID,2)=ICR(ID,6)
	ICR(ID,6)=ICR(ID,4)
	ICR(ID,4)=ICR(ID,7)
	ICR(ID,7)=I
	GOTO 6
4	I=ICR(ID,2)   !  DOWN
	ICR(ID,2)=ICR(ID,7)
	ICR(ID,7)=ICR(ID,4)
	ICR(ID,4)=ICR(ID,6)
	ICR(ID,6)=I
	GOTO 6
7	IF(IC.GT.0.AND.(ICR(ID,1).LT.3.OR.IPARM(1).EQ.0)) WRITE(LUN,8)
8	FORMAT(' .....energy too low for any motion.....'//
     C'       have you tried firing ?')
	GOTO 99
	END
