gc.7 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <USE-TOTAL "ASYLUM">
  2. <USE "MADMAN" "STR">
  3. <FLOAD "AR2:TAA;SSNAME NBIN">
  4. <GDECL (QSPACE ASPACE SSPACE MOBYSPACE LOSSSPACE)
  5. SPACE
  6. (TVASS)
  7. ASYLUM>
  8. <DEFINE MUNG ("OPTIONAL" (FN "MADMAN;TV NEW") (FLEN 300) "AUX" (D ,TVASS) N
  9. (QSP ,QSPACE) (ASP ,ASPACE) (SSP ,SSPACE) (LSP ,LOSSSPACE)
  10. (MOBYSPACE
  11. <COND (<GASSIGNED? MOBYSPACE> ,MOBYSPACE)
  12. (T <SETG MOBYSPACE <AFIND 4>>)>) DHIGH MARKV TPG)
  13. #DECL ((D N) ASYLUM (QSP ASP SSP LSP MOBYSPACE) SPACE (DHIGH) FIX
  14. (MARKV) <UVECTOR [REST FIX]> (FN) STRING (FLEN TPG) FIX)
  15. <ALLOC-MAP .D>
  16. <CONS-IT .FN .FLEN>
  17. <SETG N <SET N <OPEN-DATA-FILE .FN <COND (<GASSIGNED? N> ,N)> 7 5>>>
  18. <SETG PEEK-PAGE </ <DATA-ALLOC .N <CHTYPE #WORD *410000000000* FIX>> 1024>>
  19. <AND <SET TPG <DIRMAP .N ,PEEK-PAGE>>
  20. <DIR-INIT .TPG>
  21. <PUT <MEMQ .TPG <5 .N>> 3 1>>
  22. <SET DHIGH
  23. <CHTYPE <1 <GET-LOC <+ <* 1024 <ALLOCPAGE .D>> ,HIGHID> ![0!]>>
  24. FIX>>
  25. <SET MARKV <AIUVECTOR .MOBYSPACE .DHIGH 0>>
  26. <DATA-RESERVE .N 27>
  27. <MAPR <>
  28. <FUNCTION (X Y) <PUT .X 1 <1 .Y>>>
  29. .MARKV
  30. '![1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
  31. 25 26 27!]>
  32. <SSNAME <STRTOX "MUNGLO">>
  33. <SETG LOSSTABLE
  34. <MUNG-LOSS .N
  35. .D
  36. <ARESET .LSP>
  37. <ARESET .SSP>
  38. <ARESET .QSP>
  39. .MARKV>>
  40. <SSNAME <STRTOX "RESERV">>
  41. <DATA-PRINTW .N ,HIQNUM <DATA-READW .D ,HIQNUM>>
  42. <DATA-PRINTW .N ,TOTSCR <DATA-READW .D ,TOTSCR>>
  43. <REPEAT ((CT ,1STCAT))
  44. #DECL ((CT) FIX)
  45. <DATA-PRINTW .N .CT <DATA-READW .D .CT>>
  46. <COND (<G? <SET CT <+ .CT 1>> 22> <RETURN>)>>
  47. <DATA-PRINTW .N ,HIPOFFSET <DATA-READW .D ,HIPOFFSET>>
  48. <SSNAME <STRTOX "ANNOUN">>
  49. <MUNG-ANNOUNCE .N .D .SSP .ASP .MARKV>
  50. <SSNAME <STRTOX "MUNGQ">>
  51. <MUNG-Q .N .D .QSP .ASP .MARKV>
  52. <MUNG-LUSERS .N .D .ASP .SSP .MARKV>
  53. ZORK>
  54. <DEFINE CONS-IT (FN FLEN "AUX" (CH <OPEN "PRINTB" .FN>) (FOO <IUVECTOR 1024>)
  55. (FOO1 <IUVECTOR .FLEN '.FOO>))
  56. #DECL ((FN) STRING (CH) CHANNEL (FOO) <UVECTOR [REST <PRIMTYPE WORD>]>
  57. (FOO1) <UVECTOR [REST UVECTOR]> (FLEN) FIX)
  58. <MAPF <>
  59. <FUNCTION (X) <PRINTB .X .CH>>
  60. .FOO1>
  61. <CLOSE .CH>>
  62. "MOVE LUBLKS AND SCORES"
  63. <DEFINE MUNG-LOSS (N D LSP SSP QSP MARKV "AUX" LOSSTABLE L1 L2 NEWID NEW)
  64. #DECL ((N D) ASYLUM (LSP SSP QSP) SPACE (L1 L2 LOSSTABLE) LIST
  65. (NEWID) FIX)
  66. <SET LOSSTABLE <SET L1 <REVERSE <DATA-AREAD .D 3 <ARESET .QSP>>>>>
  67. <REPEAT ()
  68. <SET NEW <- <SET NEWID <DATA-RESERVE .N 12>> 1>>
  69. <MAPR <>
  70. <FUNCTION (X Y)
  71. #DECL ((X Y) <UVECTOR [REST FIX]>)
  72. <PUT .X 1 <SET NEW <+ .NEW 1>>>>
  73. <REST .MARKV <- <2 .L1> 1>>
  74. '![0 0 0 0 0 0 0 0 0 0 0 0!]>
  75. <DATA-APRINT .N
  76. <+ .NEWID ,SCORE>
  77. .SSP
  78. <DATA-AREAD .D <+ <2 .L1> ,SCORE> <ARESET .SSP>>>
  79. <PUT .L1 2 .NEWID>
  80. <COND (<EMPTY? <SET L2 <REST .L1 4>>>
  81. <SET LOSSTABLE <AGC <ARESET .LSP> <REVERSE .LOSSTABLE>>>
  82. <DATA-APRINT .N 3 .LSP .LOSSTABLE>
  83. <RETURN .LOSSTABLE>)
  84. (<SET L1 .L2>)>>>
  85. <DEFINE MUNG-ANNOUNCE (N D SSP ASP MARKV)
  86. #DECL ((N D) ASYLUM (SSP ASP) SPACE (MARKV) <UVECTOR [REST FIX]>)
  87. <REPEAT ((NEW ,LOMAIL) (NSTART ,LOMAIL) OLD (START ,LOMAIL) CANN)
  88. #DECL ((NSTART OLD NEW START) FIX (CANN) <OR FALSE VECTOR>)
  89. <COND (<0? <SET OLD <CHTYPE <DATA-READW .D .START> FIX>>>
  90. <DATA-PRINTW .N ,HIMAIL .NEW>
  91. <RETURN>)
  92. (<SET CANN <DATA-AREAD .D .OLD <ARESET .SSP>>>
  93. <SET NEW <1 <DATA-APRINT .N -1 .SSP .CANN>>>
  94. <PUT .MARKV .OLD .NEW>
  95. <DATA-PRINTW .N .NSTART .NEW>
  96. <SET NSTART .NEW>
  97. <SET START .OLD>)
  98. (T <PUT .MARKV .OLD ,LOMAIL> <SET START .OLD>)>>>
  99. <DEFINE MUNG-Q (N D QSP ASP MARKV "AUX" SLIST)
  100. #DECL ((N D) ASYLUM (QSP ASP) SPACE (MARKV) <UVECTOR [REST FIX]>
  101. (SLIST) <LIST [REST <PRIMTYPE WORD>]>)
  102. <REPEAT ((NSTART ,LOWQUES) CQUES (START ,LOWQUES) NEW NEW-SCORE
  103. OLD-SCORE)
  104. #DECL ((NSTART START NEW NEW-SCORE) FIX (CQUES) VECTOR)
  105. <COND (<0? <SET START <CHTYPE <DATA-READW .D .START> FIX>>>
  106. <DATA-PRINTW .N ,HIQLOC .NEW>
  107. <RETURN>)
  108. (T
  109. <SET CQUES <DATA-AREAD .D .START <ARESET .QSP>>>
  110. <COND (<N==? <QTYPE .CQUES> ,$TSIMPLE>
  111. <SET OLD-SCORE <QSCORE .CQUES>>
  112. <DATA-PRINTW .N
  113. <SET NEW-SCORE <DATA-RESERVE .N 1>>
  114. <DATA-READW .D .OLD-SCORE>>
  115. <PUT .MARKV .OLD-SCORE .NEW-SCORE>
  116. <PUT .CQUES ,QSCORE .NEW-SCORE>)>
  117. <SET NEW <1 <DATA-APRINT .N -1 .QSP .CQUES>>>
  118. <PUT .MARKV .START .NEW>
  119. <DATA-PRINTW .N .NSTART .NEW>
  120. <SET NSTART .NEW>)>>
  121. <SETG SIMPLE-SPACE <AFIND 1>>
  122. <SET SLIST <DATA-AREAD .D ,SIMPLE-LIST ,SIMPLE-SPACE>>
  123. <MAPR <>
  124. <FUNCTION (X) #DECL ((X) <LIST [REST <OR TIME FIX>]>)
  125. <COND (<TYPE? <1 .X> TIME>
  126. <PUT .X 3 <NTH .MARKV <3 .X>>>)>>
  127. .SLIST>
  128. <DATA-APRINT .N ,SIMPLE-LIST ,SIMPLE-SPACE .SLIST>>
  129. <DEFINE MUNG-LUSERS (N D ASP SSP MARKV "AUX" OLOSSTABLE)
  130. #DECL ((N D) ASYLUM (ASP SSP) SPACE (MARKV) <UVECTOR [REST FIX]>
  131. (LOSSTABLE) <LIST [REST TIME STRING FIX FIX]>)
  132. <SET LOSSTABLE <DATA-AREAD .D 3 <ARESET ,LOSSSPACE>>>
  133. <REPEAT (NINDEX CPLAYER CINDEX QASKED)
  134. #DECL ((CPLAYER) TIME (NINDEX CINDEX) FIX)
  135. <SET CPLAYER <1 .LOSSTABLE>>
  136. <SET CINDEX <3 .LOSSTABLE>>
  137. <SET NINDEX <NTH .MARKV .CINDEX>>
  138. <SSNAME .CPLAYER>
  139. <DATA-PRINTW .N
  140. <+ .NINDEX ,LASTIN>
  141. <DATA-READW .D <+ .CINDEX ,LASTIN>>>
  142. <DATA-PRINTW .N
  143. <+ .NINDEX ,LASTGRD>
  144. <DATA-READW .D <+ .CINDEX ,LASTGRD>>>
  145. <DATA-APRINT .N
  146. <+ ,NINDEX ,TAILOR>
  147. .SSP
  148. <DATA-AREAD .D <+ .CINDEX ,TAILOR> <ARESET .SSP T>>>
  149. <DATA-PRINTW .N
  150. <+ .NINDEX ,QNEXT>
  151. <NTH .MARKV
  152. <CHTYPE <DATA-READW .D <+ .CINDEX ,QNEXT>> FIX>>>
  153. <DATA-PRINTW .N
  154. <+ .NINDEX ,ANNEXT>
  155. <NTH .MARKV
  156. <CHTYPE <DATA-READW .D <+ .CINDEX ,ANNEXT>> FIX>>>
  157. <MUNG-MAIL-CHAIN .N
  158. .D
  159. .ASP
  160. .SSP
  161. .CINDEX
  162. .NINDEX
  163. .MARKV>
  164. <MUNG-GRADE-CHAIN .N
  165. .D
  166. .ASP
  167. .SSP
  168. .CINDEX
  169. .NINDEX
  170. .MARKV>
  171. <SET QASKED
  172. <DATA-AREAD .D <+ .CINDEX ,QASKED> <ARESET .SSP>>>
  173. <MAPF <>
  174. <FUNCTION (X)
  175. #DECL ((X) <LIST [REST FIX]>)
  176. <COND (<EMPTY? .X>)
  177. (T
  178. <REPEAT ()
  179. <PUT .X 1 <NTH .MARKV <1 .X>>>
  180. <COND (<EMPTY? <SET X <REST .X 2>>>
  181. <RETURN>)>>)>>
  182. .QASKED>
  183. <DATA-APRINT .N <+ .NINDEX ,QASKED> .SSP .QASKED>
  184. <COND (<EMPTY? <SET LOSSTABLE <REST .LOSSTABLE 4>>>
  185. <RETURN>)>>>
  186. <DEFINE MUNG-MAIL-CHAIN (N D ASP SSP CINDEX NINDEX MARKV)
  187. #DECL ((N D) ASYLUM (ASP SSP) SPACE (CINDEX NINDEX) FIX
  188. (MARKV) <UVECTOR [REST FIX]>)
  189. <REPEAT ((OLD <+ .CINDEX ,MNEXT>) (NEW <+ .NINDEX ,MNEXT>)
  190. (NSTART .NEW) CFROB)
  191. #DECL ((NSTART OLD NEW) FIX (CFROB) VECTOR)
  192. <COND (<0? <SET OLD <CHTYPE <DATA-READW .D .OLD> FIX>>>
  193. <DATA-PRINTW .N .NEW 0>
  194. <DATA-PRINTW .N <+ ,MLAST .NINDEX> .NEW>
  195. <RETURN>)
  196. (T
  197. <SET CFROB <DATA-AREAD .D .OLD <ARESET .ASP>>>
  198. <SET NEW <1 <DATA-APRINT .N -1 .ASP .CFROB>>>
  199. <DATA-PRINTW .N .NSTART .NEW>
  200. <SET NSTART .NEW>
  201. <PUT .MARKV .OLD .NEW>)>>>
  202. <DEFINE MUNG-GRADE-CHAIN (N D ASP SSP CINDEX NINDEX MARKV)
  203. #DECL ((N D) ASYLUM (ASP SSP) SPACE (CINDEX NINDEX) FIX
  204. (MARKV) <UVECTOR [REST FIX]>)
  205. <REPEAT ((OLD <+ .CINDEX ,ANEXT>) (NEW <+ .NINDEX ,ANEXT>)
  206. (NSTART .NEW) CFROB)
  207. #DECL ((NSTART OLD NEW) FIX (CFROB) VECTOR)
  208. <COND (<0? <SET OLD <CHTYPE <DATA-READW .D .OLD> FIX>>>
  209. <DATA-PRINTW .N .NEW 0>
  210. <DATA-PRINTW .N <+ ,ALAST .NINDEX> .NEW>
  211. <RETURN>)
  212. (T
  213. <SET CFROB <DATA-AREAD .D .OLD <ARESET .ASP>>>
  214. <PUT .CFROB ,AQUES <NTH .MARKV <AQUES .CFROB>>>
  215. <SET NEW <1 <DATA-APRINT .N -1 .ASP .CFROB>>>
  216. <DATA-PRINTW .N .NSTART .NEW>
  217. <SET NSTART .NEW>
  218. <PUT .MARKV .OLD .NEW>)>>>
  219. <DEFINE REVERSE (FOO "AUX" (TTE <REST .FOO>) (RETL ()))
  220. #DECL ((FOO TTE RETL VALUE) LIST)
  221. <COND (<EMPTY? .TTE> .FOO)
  222. (T
  223. <REPEAT ()
  224. <SET RETL <PUTREST .FOO .RETL>>
  225. <COND (<EMPTY? <SET TTE <REST <SET FOO .TTE>>>>
  226. <RETURN <PUTREST .FOO .RETL>>)>>)>>