babble.15 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. T ; "IF TRIVIA IS AROUND"
  2. <USE "CALSYM">
  3. <OR <GASSIGNED? $TLOSE>
  4. <PROG ()
  5. <NEWTYPE ASYLUM VECTOR>
  6. <NEWTYPE SPACE VECTOR>
  7. <SETG $SBABBLE 2>
  8. <SETG SCORE 3>
  9. <MANIFEST SCORE $SBABBLE>
  10. <SETG CATS <MAKESST "FOO" []>>>>
  11. <DEFINE MOBY-VEC ("AUX" (TVA ,TVASS) (TVS ,TVSPACE)
  12. LST UV SCORE QUESTIONS)
  13. #DECL ((LST) LIST (UV) <UVECTOR [REST FLOAT]> (TVA) ASYLUM (TVS) SPACE
  14. (SCORE) <UVECTOR [15 <UVECTOR [2 FLOAT]>]>
  15. (QUESTIONS) <VECTOR [15 <LIST [REST FIX]>]>)
  16. <SET LST <DATA-READ-CAREFUL .TVA
  17. ,LUSERS
  18. <ARESET ,TVSPACE1>
  19. "can't read losstable"
  20. MOBY-VEC>>
  21. <SET UV <AIUVECTOR <COND (<GASSIGNED? MOBYSPACE>
  22. <ARESET ,MOBYSPACE>)
  23. (<SETG MOBYSPACE <AFIND 3>>)>
  24. <* </ <LENGTH .LST> 4> 66>
  25. 0.000>>
  26. <REPEAT ((L .LST) (U .UV) CNT1 CNT2 QCT)
  27. #DECL ((L) LIST (U) UVECTOR (CNT1 CNT2) FLOAT (QCT) FIX)
  28. <AND <TYPE? <1 .L> FIX> <RETURN>>
  29. <PUT .UV 1 <CHTYPE <STRTOX <1 .L>> FLOAT>>
  30. <SET UV <REST .UV 1>>
  31. <SET SCORE <DATA-READ-CAREFUL .TVA
  32. <+ <3 .L> ,SCORE>
  33. <ARESET .TVS>
  34. "can't read player score"
  35. MOBY-VEC>>
  36. <SET QUESTIONS
  37. <DATA-READ-CAREFUL .TVA
  38. <+ <3 .L> ,QASKED>
  39. <ARESET ,TVSPACE2>
  40. "can't read player questions"
  41. MOBY-VEC>>
  42. <SET CNT1 0.000>
  43. <SET CNT2 0.000>
  44. <SET QCT 0>
  45. <MAPF <>
  46. <FUNCTION (SUV QLIST "AUX" (SUV1 <1 .SUV>) (SUV2 <2 .SUV>)
  47. (QNUM </ <LENGTH .QLIST> 2>))
  48. #DECL ((SUV) <UVECTOR [2 FLOAT]> (QLIST) LIST
  49. (SUV1 SUV2) FLOAT (QNUM) FIX)
  50. <PUT .UV 1 .SUV1>
  51. <SET CNT1 <+ .CNT1 .SUV1>>
  52. <PUT .UV 2 .SUV2>
  53. <SET CNT2 <+ .CNT2 .SUV2>>
  54. <PUT .UV 3 </ .SUV1 .SUV2>>
  55. <PUT .UV 4 <CHTYPE .QNUM FLOAT>>
  56. <SET QCT <+ .QCT .QNUM>>
  57. <SET UV <REST .UV 4>>>
  58. .SCORE
  59. .QUESTIONS>
  60. <PUT .UV 1 .CNT1>
  61. <PUT .UV 2 .CNT2>
  62. <PUT .UV 3 </ .CNT1 .CNT2>>
  63. <PUT .UV 4 <CHTYPE .QCT FLOAT>>
  64. <SET UV <REST .UV 5>>
  65. <SET L <REST .L 4>>>
  66. <SETG MOBY <TOP .UV>>>
  67. <DEFINE DATA-READ-CAREFUL (A ID SPACE ERR "TUPLE" ERRS)
  68. #DECL ((A) ASYLUM (ID) <PRIMTYPE WORD> (SPACE) SPACE
  69. (ERR) STRING)
  70. <PROG (TMP (CT 0))
  71. <COND (<SET TMP <DATA-AREAD .A .ID .SPACE>>)
  72. (<OR
  73. <NOT <MEMQ <1 .TMP> '![5 7 8]>>
  74. <G? <SET CT <+ .CT 1>> 10>>
  75. <PERR .ERR .TMP !.ERRS>
  76. <SET CT 0>)
  77. (T
  78. <SLEEP 1>
  79. <AGAIN>)>>>
  80. <DEFINE BABBLE-SORT ("AUX" (UV <COND (<AND <SET-STATUS ,$SBABBLE> <>>)
  81. (<GASSIGNED? MOBY> ,MOBY)
  82. (<ARESET ,MOBYSPACE> <MOBY-VEC>)>) HOW)
  83. #DECL ((HOW) <OR FALSE <VECTOR [2 ANY]>> (UV) UVECTOR)
  84. <COND (<SET HOW
  85. <READARGS ,ONSYMS
  86. "On"
  87. '["" ""]
  88. '["SYM"]
  89. ,BYSYMS
  90. "by"
  91. '["" ""]
  92. '["SYM"]>>
  93. <COND (<AND <1 .HOW> <2 .HOW>>
  94. <SORT <>
  95. .UV
  96. 66
  97. <COND (<0? <2 <1 .HOW>>> 0)
  98. (<+ 1
  99. <* 4 <- <2 <1 .HOW>> 1>>
  100. <2 <2 .HOW>>>)>>
  101. <BABBLE .UV .HOW>)>)>>
  102. <DEFINE BABBLE (UV HOW "AUX" OFFSET)
  103. #DECL ((UV) UVECTOR (HOW) <VECTOR [2 <<PRIMTYPE VECTOR> ANY FIX>]> (OFFSET) FIX)
  104. <COND (<0? <2 <1 .HOW>>>
  105. <PUT <1 .HOW> 2 16>)>
  106. <SET OFFSET <+ 2 <* 4 <- <2 <1 .HOW>> 1>>>>
  107. <CRLF>
  108. <INDENT-TO 22>
  109. <PRINC <1 <1 .HOW>>>
  110. <PRINC "
  111. Points Maximum Percentage Questions
  112. ">
  113. <SET UV <REST .UV <LENGTH .UV>>>
  114. <REPEAT ((CT 0)) #DECL ((CT) FIX)
  115. <COND (<==? .UV <TOP .UV>> <RETURN>)
  116. (<SET UV <BACK .UV 66>>
  117. <PRINC <SIXTOS <1 .UV>>>
  118. <INDENT-TO 12>
  119. <PRIN1 <NTH .UV .OFFSET>>
  120. <INDENT-TO 22>
  121. <PRIN1 <NTH .UV <+ .OFFSET 1>>>
  122. <INDENT-TO 33>
  123. <PRIN1 <NTH .UV <+ .OFFSET 2>>>
  124. <INDENT-TO 47>
  125. <PRIN1 <CHTYPE <NTH .UV <+ .OFFSET 3>> FIX>>
  126. <CRLF>
  127. <COND (<0? <MOD <SET CT <+ .CT 1>> 5>>
  128. <CRLF>)>)>>>
  129. <SETG SPECS <MAKEBST "FVROB" '["Name" 0 "Total" 16]>>
  130. <SETG ONSYMS <MAKEMST "FROB" [,CATS ,SPECS]>>
  131. <SETG BYSYMS
  132. <MAKEBST "FROB" '["Maximum" 1 "Percentage" 2 "Questions" 3 "Total" 0]>>