	PROGRAM MAIN
C	TEST PROGRAM FOR SUBROUTINES
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,BELL
	DIMENSION ISEQ(8)
	WRITE(5,1)
1	FORMAT('+CRAWLER -- INITIALIZING'/' >',$)
C 
C	INITIALIZE TERMINALS, CUBE, CRAWLERS:
	NT=0  ! NUMBER OF CURRENT TURN
	CALL CINIT
C 
C	CHECK FOR ENDGAME:
9	CALL TINIT(ISEQ)
	IF(ISEQ(1).EQ.-1) GOTO 999  ! SOMEONE (OR THE CUBE) HAS WON
C 
C 
	DO 100 NEXT=1,8
	ID=ISEQ(NEXT)
	IF(ICR(ID,1).EQ.0) GOTO 100
	DO 301 I=1,8
	BELL=' '
	IF(I.EQ.ID) BELL="7
	IF(ICR(I,1).GT.0.AND.ICR(I,1).LT.3) WRITE(ICR(I,8),302) ID,BELL
301	CONTINUE
302	FORMAT(' <activating crawler',I2,'>',A1)
	WRITE(5,302) ID
C 
C	DEAL WITH AUTOMATED CRAWLERS HERE.
	IF(ICR(ID,1).LT.3) GOTO 98
	CALL AUTO(ID)
	GOTO 100
98	LUN=ICR(ID,8)
	IF(ICR(ID,1).NE.1) GOTO 99  ! STATUS=2: OUTSIDE CUBE
	CALL PLAY(ID)
	GOTO 100
99	CALL OUTSID(ID)
100	CONTINUE
	GOTO 9 ! UPDATE CUBE ENERGY LEVELS, INITIALIZE NEW TURN
999	STOP
	END
