        LOGICAL FUNCTION WIZARD(CHECK)
C  ASK IF HE'S A WIZARD.  IF HE SAYS YES, MAKE HIM PROVE IT.  RETURN TRUE IF HE
C  REALLY IS A WIZARD.
        IMPLICIT INTEGER(A-Z)
      INTEGER*4 WKDAY,WKEND,HOLID
!      REAL*8 MAGIC,WORD,X,Y,Z
      CHARACTER*8 MAGIC,WORD,X,Y,Z
        LOGICAL YESM,EQV,CHECK,IZZWIZ
        DIMENSION HNAME(10),VAL(5)
      DIMENSION VEC(15)
        COMMON /WIZCOM/ WKDAY,WKEND,HOLID,HBEGIN,HEND,HNAME,
     1          SHORT,MAGIC,MAGNM,LATNCY,SAVED,SAVET,SETUP
      DATA IZZWIZ/.FALSE./

C WELL, I DON'T HAVE A TIMDAT SUBRUTINE AND I DON'T KNOW WHAT IT DOES
C SO I'M SKIPPING THIS PRELIMINARY CHECKING STUFF. M.V.
      WIZARD=.FALSE.
      GOTO 1

C      CALL TIMDAT(VEC,15)
C REMOVED THE ABOVE LINE BECOUSE OF LINKER ERROR. SKIPPING ANYWAY. M.V.
      WIZARD=.FALSE.
      IF(IZZWIZ)WIZARD=.TRUE.
      IF(CHECK)IZZWIZ=.FALSE.
      IF(EQV('ETTEMA',VEC(13)).OR.EQV('WIZARD',VEC(13)).OR.EQV
     +('RUGG  ',VEC(13)))WIZARD=.TRUE.
 1    IF(WIZARD) RETURN !LABEL ADDED BY ME. M.V.
        WIZARD=YESM(16,0,7)
        IF(.NOT.WIZARD)RETURN
C  HE SAYS HE IS.  FIRST STEP: DOES HE KNOW ANYTHING MAGICAL?
        CALL MSPEAK(17)
C echo off
C      CALL DUPLX$(:100000)
        CALL GETIN(WORD,X,Y,Z)
C echo back on...
C      CALL DUPLX$(:0)
      IF(WORD.NE.MAGIC)GOTO 99
CC  HE DOES.  GIVE HIM A RANDOM CHALLENGE AND CHECK HIS REPLY.
C        CALL DATIME(D,T)
C        T=T*2+1
C        WORD='@@@@@'
C        DO 15 Y=1,5
C        X=79+MOD(D,5)
C        D=D/5
C        DO 12 Z=1,X
C12      T=MOD(T*1027,1048576)
C        VAL(Y)=(T*26)/1048576+1
C15      WORD=WORD+SHIFT(VAL(Y),36-7*Y)
        IF(YESM(18,0,0))GOTO 99
C        WRITE(1,18)WORD
C18      FORMAT(/1X,A5)
C        CALL GETIN(WORD,X,Y,Z)
C        CALL DATIME(D,T)
C        T=(T/60)*40+(T/10)*10
C        D=MAGNM
C        DO 19 Y=1,5
C        Z=MOD(Y,5)+1
C        X=MOD(IABS(VAL(Y)-VAL(Z))*MOD(D,10)+MOD(T,10),26)+1
C        T=T/10
C        D=D/10
C19      WORD=WORD-SHIFT(X,36-7*Y)
C        IF(WORD.NE.'@@@@@')GOTO 99
C  BY GEORGE, HE REALLY *IS* A WIZARD!
      IF(EQV(VEC(13),'PHYS  ')) GOTO 1001
      CALL DATIME(D,T)
      T1=(T/60)*400
      T2=(T/60)*40+(T/10)*10
      T=T1+(T2/10)
      CALL MSPEAK(33)
C echo off
C      CALL DUPLX$(:100000)
      WRITE(1,102)
      READ(1,101)INNUM
C echo back on...
C      CALL DUPLX$(:0)
      NUM=MOD(MAGNM/1000 + T/1000,10)*1000
      DIG2=MOD(MAGNM/100,10)
      TDIG2=MOD(T/100,10)
      NUM=NUM+MOD(TDIG2+DIG2,10)*100
      DIG2=MOD(MAGNM/10,10)
      TDIG2=MOD(T/10,10)
      NUM=NUM + MOD(TDIG2+DIG2,10)*10
      DIG2=MOD(MAGNM,10)
      TDIG2=MOD(T,10)
      NUM =NUM +MOD(TDIG2+DIG2,10)
C      IF(NUM.NE.INNUM)GOTO 99
1001    CALL MSPEAK(19)
      IF(.NOT.CHECK)IZZWIZ=.TRUE.
        RETURN
C  AHA!  AN IMPOSTOR!
99      CALL MSPEAK(20)
        WIZARD=.FALSE.
        RETURN
101   FORMAT(I4)
102   FORMAT(' ')
        END
