dso7.for 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. C ENCRYP-- ENCRYPT PASSWORD
  2. C
  3. C COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142
  4. C ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED
  5. C WRITTEN BY R. M. SUPNIK
  6. C
  7. C DECLARATIONS
  8. C
  9. SUBROUTINE ENCRYP(INW,OUTW)
  10. IMPLICIT INTEGER(A-Z)
  11. CHARACTER INW(6),OUTW(6)
  12. CHARACTER KEYW(6),UKEYW(6)
  13. INTEGER UINW(6)
  14. DATA KEYW/'E','C','O','R','M','S'/
  15. C
  16. UINWS=0
  17. C !UNBIASED INW SUM.
  18. UKEYWS=0
  19. C !UNBIASED KEYW SUM.
  20. J=1
  21. C !POINTER IN KEYWORD.
  22. DO 100 I=1,6
  23. C !UNBIAS, COMPUTE SUMS.
  24. UKEYW(I)=char(ichar(KEYW(I))-64)
  25. IF(INW(J).LE.char(64)) J=1
  26. C UINW(I)=char(ichar(INW(J))-64)
  27. UINW(I)=ichar(INW(J))-64
  28. UKEYWS=UKEYWS+ichar(UKEYW(I))
  29. UINWS=UINWS+UINW(I)
  30. J=J+1
  31. 100 CONTINUE
  32. C
  33. USUM=MOD(UINWS,8)+(8*MOD(UKEYWS,8))
  34. C !COMPUTE MASK.
  35. DO 200 I=1,6
  36. J=IAND(IEOR(IEOR(UINW(I),ichar(UKEYW(I))),USUM),31)
  37. USUM=MOD(USUM+1,32)
  38. IF(J.GT.26) J=MOD(J,26)
  39. OUTW(I)=char(MAX0(1,J)+64)
  40. 200 CONTINUE
  41. RETURN
  42. C
  43. END
  44. C CPGOTO-- MOVE TO NEXT STATE IN PUZZLE ROOM
  45. C
  46. C DECLARATIONS
  47. C
  48. SUBROUTINE CPGOTO(ST)
  49. IMPLICIT INTEGER(A-Z)
  50. C
  51. COMMON /HYPER/ HFACTR
  52. include 'rooms.h'
  53. include 'rflag.h'
  54. include 'rindex.h'
  55. include 'objects.h'
  56. include 'oflags.h'
  57. include 'flags.h'
  58. C CPGOTO, PAGE 2
  59. C
  60. RFLAG(CPUZZ)=IAND(RFLAG(CPUZZ),not(RSEEN))
  61. DO 100 I=1,OLNT
  62. C !RELOCATE OBJECTS.
  63. IF((OROOM(I).EQ.CPUZZ).AND.
  64. & (IAND(OFLAG2(I),(ACTRBT+VILLBT)).EQ.0))
  65. & CALL NEWSTA(I,0,CPHERE*HFACTR,0,0)
  66. IF(OROOM(I).EQ.(ST*HFACTR))
  67. & CALL NEWSTA(I,0,CPUZZ,0,0)
  68. 100 CONTINUE
  69. CPHERE=ST
  70. RETURN
  71. C
  72. END
  73. C CPINFO-- DESCRIBE PUZZLE ROOM
  74. C
  75. C DECLARATIONS
  76. C
  77. SUBROUTINE CPINFO(RMK,ST)
  78. IMPLICIT INTEGER(A-Z)
  79. INTEGER DGMOFT(8)
  80. CHARACTER DGM(8),PICT(5),QMK
  81. C
  82. COMMON /CHAN/ INPCH,OUTCH,DBCH
  83. C
  84. C PUZZLE ROOM
  85. C
  86. COMMON /PUZZLE/ CPDR(16),CPWL(8),CPVEC(64)
  87. include 'flags.h'
  88. C
  89. C FUNCTIONS AND LOCAL DATA
  90. C
  91. C
  92. DATA DGMOFT/-9,-8,-7,-1,1,7,8,9/
  93. DATA PICT/'SS','SS','SS',' ','MM'/
  94. DATA QMK/'??'/
  95. C CPINFO, PAGE 2
  96. C
  97. CALL RSPEAK(RMK)
  98. DO 100 I=1,8
  99. J=DGMOFT(I)
  100. DGM(I)=PICT(CPVEC(ST+J)+4)
  101. C !GET PICTURE ELEMENT.
  102. IF((IABS(J).EQ.1).OR.(IABS(J).EQ.8)) GO TO 100
  103. K=8
  104. IF(J.LT.0) K=-8
  105. C !GET ORTHO DIR.
  106. L=J-K
  107. IF((CPVEC(ST+K).NE.0).AND.(CPVEC(ST+L).NE.0))
  108. & DGM(I)=QMK
  109. 100 CONTINUE
  110. WRITE(OUTCH,10) DGM
  111. C
  112. IF(ST.EQ.10) CALL RSPEAK(870)
  113. C !AT HOLE?
  114. IF(ST.EQ.37) CALL RSPEAK(871)
  115. C !AT NICHE?
  116. I=872
  117. C !DOOR OPEN?
  118. IF(CPOUTF) I=873
  119. IF(ST.EQ.52) CALL RSPEAK(I)
  120. C !AT DOOR?
  121. IF(CPVEC(ST+1).EQ.-2) CALL RSPEAK(874)
  122. C !EAST LADDER?
  123. IF(CPVEC(ST-1).EQ.-3) CALL RSPEAK(875)
  124. C !WEST LADDER?
  125. RETURN
  126. C
  127. 10 FORMAT(' |',A2,1X,A2,1X,A2,'|'/,
  128. &' West |',A2,' .. ',A2,'| East',/
  129. &' |',A2,1X,A2,1X,A2,'|')
  130. C
  131. END