	SUBROUTINE CINIT
C	ROUTINE TO INITIALIZE CRAWLERS, TERMINALS AND CUBE
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 ANS,TID(6)
C 
C 
C	SET PARAMETERS IN PARMS ROUTINE:
	IPARM(1)=1  ! MESSAGES
	IPARM(2)=1  ! DELAYS ON CUBE CRAWLERS
	IPARM(3)=0  ! DESTROYED COORDINATES
	IPARM(4)=1  ! X-RAY AND SCAN DELAY
	IPARM(5)=0  ! WHOLE-CUBE SCAN DELAY
	IPARM(6)=11 ! MAX. CUBE-SPACE ENERGY LEVEL
	IPARM(7)=0  ! CRAWLER STATUS STRING (FOR DEBUGS)
	IPARM(8)=0  ! LUN'S ASSIGNED
C 
C 
C 
	CALL CUBE  ! INITIALIZE CUBE SPACES
C 
	CALL AINIT  ! "WELCOME TO CRAWLER" DISPLAY
C 
C 
C	CLEAR SCREEN FORMAT:
321	FORMAT(X,A1,'Y  ',A1,'k',A1,'J'/'+      ')
C 
8	READ(5,4,ERR=5) NP
4	FORMAT(I1)
	IF(NP.GT.0.AND.NP.LT.5) GOTO 7
5	WRITE(5,6)
6	FORMAT('0let`s get this game off to a better start than that !'/
     C' Enter 1, 2, 3 or 4: ',$)
	GOTO 8
7	WRITE(5,321) "33,"33,"33  ! CLEAR SCREEN
	WRITE(5,9) 8-NP
9	FORMAT(////' How many CRAWLERS will be controled by the cube ?'/
     C' Enter a number from 0 to ',I1,': ',$)
	READ(5,4,ERR=7) MP
	IF(MP.GT.8-NP) GOTO 7
	IF(MP.GT.0) WRITE(5,11)
11	FORMAT(//'0Any messages concerning the CUBE`s crawlers will be'/
     C' displayed on this terminal.'//)
353	FORMAT(A1)
C 
	DO 12 I=1,NP
	WRITE(5,13) I
	READ(5,2) TID
	CALL ASSIGN(I,TID,6)
	ICR(I,8)=I  ! ASSIGN LUN TO CRAWLER
	ICR(I,1)=1  ! BRING CRAWLER TO LIFE INSIDE CUBE
	ICR(I,9)=3  ! ASSIGN ENERGY LEVELS
12	CONTINUE
2	FORMAT(6A1)
13	FORMAT('0Player',I2,', what terminal (TT2:, TT12:, etc.) will'/
     C' you be using ?   ',$)
	DO 15 I=NP+1,NP+MP
	ICR(I,1)=3 ! CUBE-CONTROLLED, IN CUBE
	ICR(I,8)=5 ! WRITES TO THIS TERMINAL
	ICR(I,9)=5 ! ENERGY
15	CONTINUE
	DO 115 I=NP+MP+1,8
	ICR(I,1)=0
	ICR(I,8)=5
115	CONTINUE
	DO 16 I=1,NP
	LUN=ICR(I,8)
	CALL TERM(LUN)
16	CONTINUE
	WRITE(5,77)
77	FORMAT(////////' ...and for automatic crawlers,')
	LUN=5
	CALL TERM(LUN)
	DO 78 I=NP+1,8
	CLEAR(I)=CLEAR(5)
78	CONTINUE
C 
C	FILL UP DIRECTIONS, LOCATIONS IN ICR:
	CALL CFILL(NP,MP)
C 
	DO 21 I=1,NP
	WRITE(I,22) "33,"33,CLEAR(I)
21	CONTINUE
22	FORMAT(X,A1,'Y  ',A1,A1,///' ALL PLAYERS -- CUBE IS READY'//
     C' For HELP enter H on your turn.'//
     C' [NOTE]-- the <CR> prompt is the game`s way of asking for a'/
     C' response at the terminal.  Hit the NEW LINE, RETURN or ENTER'/
     C' key.  (CR stands for carriage return)')
	RETURN
	END
