12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493 |
- <SETG FROBS
- '![<MAKE.QUESTIONS>
- <ASK.QUESTIONS>
- <GRADE.STUFF>
- <READ.MAIL>
- <BABBLE-SORT>
- <PSCORES>
- <PRINT.QSCORE>!]>
- <SETG FROB-NAMES
- '["
- Making Questions.
- "
- "
- Answering Questions.
- "
- "
- Grading/Reading Answers.
- "
- "
- Reading mail.
- "
- "
- Babbling.
- "
- "
- Printing scores.
- "
- "
- Status of questions
- "]>
- <SETG TUV <IUVECTOR 4 0>>
- <SETG TTUV <IUVECTOR 1 0>>
- <SETG TBUV <IUVECTOR 4 0>>
- <SETG FOOUV <IUVECTOR 4 0>>
- <GDECL (TUV TBUV FOOUV)
- <UVECTOR [4 FIX]>
- (TTUV)
- <UVECTOR FIX>>
- <SETG STATUS-VECTOR
- '[0
- "Grade"
- 1
- "Answer"
- 2
- "Babble"
- 3
- "Read mail"
- 4
- "Make"
- 5
- "Peek"
- 6
- "Start up"
- 7
- "Print score"
- 8
- "Command"
- 9
- "Update"
- 10
- "Status"
- 11
- "FLUSH"
- 12
- "ERROR"
- 13
- "SHOUT"]>
- <DEFINE DFUMP ("OPTIONAL" (FNAM "MADMAN;TV FOO"))
- #DECL ((FNAM) STRING)
- <DEBUG>
- <FUMP -1 ,TIME -1 .FNAM>>
- <GDECL (PG) FIX (LASTMAIL) WORD>
- <DEFINE FUMP (VERSION
- "OPTIONAL" (SAVER ,TIME) (MOD 0) (FNAM "MADMAN;TV FILE")
- "AUX" M PLAYERS TEMP)
- #DECL ((VERSION MOD) FIX (M) <OR FALSE LIST> (SAVER) APPLICABLE
- (PLAYERS) STRUCTURED (TEMP) FIX (FNAM) STRING)
- <COND (<=? <APPLY .SAVER "MADMAN;TRV SAVFIL"> "SAVED">)
- (<AND <DINIT> <>>)
- (<AND <=? <JNAME> "DEBUG"> <MEMBER <XUNAME> ,WINNERS>>
- <SETG TVASS <OPEN-DATA-FILE .FNAM <> 7 5>>
- "LOSING")
- (<SETG TVASS <OPEN-DATA-FILE .FNAM <> 7 5>>
- <COMREP>
- <PRINC "
- TRIVIA.">
- <PRIN1 .VERSION>
- <COND (<0? .MOD>) (<PRINC "."> <PRIN1 .MOD>)>
- <CRLF>
- <IPC-OFF>
- <IPC-ON <XUNAME> "TRIVIA">
- <INIT> ;"SET UP TTY'S"
- <SET IMLAC? <==? <MOD <11 ,INCHAN> 128> 2>>
- <SETG TVSPACE <AFIND 1>>
- <SETG TVSPACE1 <AFIND 1>>
- <SETG TVSPACE2 <AFIND 1>>
- <SETG LOSSSPACE <AFIND 1>>
- <SETG MOBYSPACE <AFIND 4>>
- <SETG LOSSTABLE <DATA-AREAD ,TVASS ,LUSERS ,LOSSSPACE>>
- <RESET ,INCHAN>
- <COND (<SET M <MEMBER <SETG PLAYER <XUNAME>> ,LOSSTABLE>>
- <SETG LUBLK <3 .M>>
- <SETG TINDEX <4 .M>>
- <OR <PASS-CHECK <2 .M>> <QUIT>>
- <PRINC "
- Last played ">
- <PDSKDATE <DATA-READW ,TVASS <+ ,LUBLK ,LASTIN>>>)
- (<SETG LUBLK <NEW-USER ,PLAYER>>)>
- <AND <SET PG <DIRMAP ,TVASS ,PEEK-PAGE>>
- <DIR-INIT .PG>
- <PUT <MEMQ .PG <5 ,TVASS>> 3 1>
- <SET TEMP
- <+ ,PEEK-START
- <SETG PG <* .PG 1024>>
- <SETG TINDEX <* ,TINDEX 4>>>>
- <PUT-LOC <+ .TEMP 1> '![0!]>
- <DHLOCK .TEMP>>
- <UPDATE-BABBLE ,LUBLK ,TINDEX>
- <PUT ,TUV 2 <STRTOX ,PLAYER>>
- <PUT ,TUV 3 <CHTYPE <DSKDATE> FIX>>
- <SET-STATUS ,$SWAKE>
- <DATA-PRINTW ,TVASS <+ ,LUBLK ,LASTIN> <DSKDATE>>
- <SETG LASTMAIL
- <CHTYPE <1 <GET-LOC <+ ,PG 1 ,TELEC-START ,TINDEX> ,TTUV>>
- WORD>>
- <READ.ANNOUNCE>
- <PLAY-BALL>)
- (<PRINC "
- TRIVIA DATA BASE MISSING?
- "> <QUIT>)>>
- <DEFINE UPDATE-BABBLE (LUBLK TINDEX
- "AUX" SCORE (TBUV ,TBUV) (PG ,PG) LOC (TTUV ,TTUV))
- #DECL ((LOC LUBLK TINDEX PG) FIX (TBUV) <UVECTOR [3 FIX]>
- (SCORE) <OR FALSE <UVECTOR [REST UVECTOR]>> (TTUV) <UVECTOR FIX>)
- <PUT-LOC <+ .PG ,TELEC-START .TINDEX 2> <PUT .TTUV 1 0>>
- <SET LOC <+ .PG ,BABBLE-START .TINDEX>>
- <UNWIND <PROG (SCOREM (TOTAL 0.000) (POSS 0.000))
- #DECL ((SCOREM) <OR FALSE MANIAC> (TOTAL POSS) FLOAT)
- <COND (<DHLOCK .LOC>
- <SET SCORE
- <DATA-AREAD ,TVASS
- <+ .LUBLK ,SCORE>
- <ARESET ,TVSPACE>>>
- <GET-LOC .LOC .TBUV>
- <PUT .TBUV 2 <GETLASTQ .LUBLK>>
- <MAPF <>
- <FUNCTION (X)
- <SET TOTAL <+ .TOTAL <1 .X>>>
- <SET POSS <+ .POSS <2 .X>>>>
- .SCORE>
- <PUT .TBUV 3 <CHTYPE .TOTAL FIX>>
- <PUT .TBUV 4 <CHTYPE .POSS FIX>>
- <PUT-LOC .LOC .TBUV>
- <DUNLOCK .LOC>)
- (<SLEEP 1> <AGAIN>)>>
- <DUNLOCK .LOC>>>
- <SETG VERBOSE <>>
- <DEFINE DO-TELECON ("AUX" FX)
- #DECL ((FX) <OR FALSE FIX>)
- <COND (<SET FX
- <READER '[] "at intervals of " '["" ""] '["FIX"] ,VERBOSE>>
- <TELECON .FX>)>>
- <SETG TELEC-INTERVAL 0>
- <GDECL (TELEC-INTERVAL) FIX>
- <DEFINE TELECON (AMT)
- #DECL ((AMT) FIX)
- <SETG TELEC-INTERVAL .AMT>
- <COND (<GASSIGNED? RTIMINT>)
- (<SETG RTIMINT <ON "REALT" ,CHECK.MAIL 1>>)>
- <PUT-LOC <+ ,PG ,TELEC-START ,TINDEX 2>
- <PUT ,TTUV 1 *400000000000*>>
- <REALTIMER .AMT>>
- <DEFINE OFFTELECON ()
- <COND (<GASSIGNED? RTIMINT>
- <SETG TELEC-INTERVAL 0>
- <OFF ,RTIMINT>
- <PUT-LOC <+ ,PG ,TELEC-START ,TINDEX 2> <PUT ,TTUV 1 0>>
- <GUNASSIGN RTIMINT>)>>
- <DEFINE CHECK.MAIL ("AUX" (TVA ,TVASS) LST (UV ,TTUV) (TINDEX ,TINDEX))
- #DECL ((TVA) ASYLUM (LST) WORD (UV) <UVECTOR FIX> (TINDEX) FIX)
- <COND (<==? <CHTYPE <GETBITS <1 <GET-LOC <+ ,PG ,PEEK-START .TINDEX 3>
- .UV>>
- <BITS 18 18>>
- FIX>
- ,$SREAD>)
- (<==? <SET LST
- <CHTYPE <1 <GET-LOC <+ ,TELEC-START ,PG .TINDEX 1>
- .UV>>
- WORD>>
- ,LASTMAIL>)
- (<SETG LASTMAIL .LST> <PRINC "
- --MESSAGE HERE--
- ">)>
- <INT-LEVEL 0>
- <DISMISS T>>
- <SETG PNEWMAIL <>>
- <SETG WINNERS ("MARC" "TAA" "JMB")>
- <DEFINE PASS-CHECK (PW "AUX" PS I)
- #DECL ((PS PW) STRING (I) HANDLER)
- <SET I
- <ON "CHAR"
- <FUNCTION (R N)
- #DECL ((R) CHARACTER (N) CHANNEL)
- <COND (<==? .R <ASCII 19>>
- <OR <MEMBER <XUNAME> ,WINNERS> <QUIT>>)>>
- 8
- 0
- ,INCHAN>>
- <REPEAT ((N 3))
- <RESET .INCHAN>
- <TTYECHO .INCHAN <>>
- <PRINC "
- Password: ">
- <READSTRING <SET PS <ISTRING 10>> .INCHAN ,PWTERM>
- <UPPERCASE .PS>
- <TTYECHO .INCHAN T>
- <COND (<=? .PS .PW> <OFF .I> <RETURN T>)
- (<SET N <- .N 1>> <AND <L? .N 0> <OFF .I> <RETURN <>>>)>>>
- <DEFINE NEW-USER (XUNM "AUX" PS VEC (TVA ,TVASS) (TVS ,TVSPACE))
- #DECL ((PS XUNM) STRING (VEC) <UVECTOR [REST UVECTOR]> (TVA) ASYLUM
- (TVS) SPACE)
- <PROG ()
- <SET PS <ISTRING 10>>
- <PRINC "
- Your TRIVIA password: ">
- <RESET .INCHAN>
- <TTYECHO .INCHAN <>>
- <READSTRING .PS .INCHAN ,PWTERM>
- <UPPERCASE .PS>
- <COND (<MEMQ <1 .PS> '(!" !"
!"î)>
- <PRINC "
- Illegal password.">
- <AGAIN>)>
- <TTYECHO .INCHAN T>
- <PRINC "
- Please confirm your chosen password,">
- <OR <PASS-CHECK .PS> <AGAIN>>
- <PROG (L)
- #DECL ((L) <OR FALSE FIX>)
- <COND
- (<SET L <DATA-RESERVE .TVA ,LBLEN>>
- <PROG (CRAZY P)
- #DECL ((CRAZY) <OR FALSE MANIAC> (P) LIST)
- <COND
- (<SET CRAZY <DATA-OPEN "PRINT" .TVA ,LUSERS>>
- <UNWIND
- <PROG (TINDEX)
- #DECL ((TINDEX) FIX)
- <COND (<==? <SET TINDEX
- <CHTYPE <DATA-READW .TVA ,HIPOFFSET> FIX>>
- 83>
- <PERR "Can't make NEW-USER--no slots available">)
- (T
- <SETG TINDEX .TINDEX>
- <DATA-PRINTW .TVA ,HIPOFFSET <+ .TINDEX 1>>)>
- <ARESET .TVS>
- <SET P <DATA-AREAD .TVA ,LUSERS .TVS>>
- <SET P <PUTREST <ALIST .TVS .TINDEX> .P>>
- <SET P <PUTREST <ALIST .TVS .L> .P>>
- <SET P <PUTREST <ALIST .TVS <ACOPY .TVS .PS>> .P>>
- <SET P <PUTREST <ALIST .TVS <ACOPY .TVS .XUNM>> .P>>
- <OR <DATA-IPRINT .TVA .CRAZY .TVS .P>
- <PERR "Can't print NEW-USER">>
- <DATA-CLOSE .TVA .CRAZY>>
- <DATA-CLOSE .TVA .CRAZY>>
- <SET VEC <AIUVECTOR <ARESET .TVS> ,NCAT <AUVECTOR .TVS>>>
- <MAPR <>
- <FUNCTION (X) <PUT .X 1 <AUVECTOR .TVS 0.000 0.000>>>
- .VEC>
- <DATA-APRINT .TVA <+ .L ,SCORE> .TVS .VEC>
- <DATA-APRINT .TVA
- <+ .L ,QASKED>
- .TVS
- <AIVECTOR <ARESET .TVS> ,NCAT <ALIST .TVS>>>
- <DATA-PRINTW .TVA <+ .L ,QNEXT> ,LOWQUES>
- <DATA-PRINTW .TVA <+ .L ,ALAST> <+ .L ,ANEXT>>
- <DATA-PRINTW .TVA <+ .L ,MLAST> <+ .L ,MNEXT>>
- <DATA-PRINTW .TVA <+ .L ,ANNEXT> ,LOMAIL>
- .L)
- (<AGAIN>)>>)
- (<AGAIN>)>>>>
- <DEFINE COMMAND ("AUX" RD)
- #DECL ((RD) <OR FALSE SYMBOL>)
- <REPEAT ()
- <AND ,FLUSH <FLUSH-EM>>
- <SET-STATUS ,$SCOM>
- <COND (<SET RD <READER ,MCOMS "
- @" '["" ""] ["SYM"] <>>>
- <EVAL <2 .RD>>)>>>
- <SETG COMS
- <MAKEBST "COMMANDS"
- '["Announce"
- <ANNOUNCE>
- "Answer"
- <ASK.QUESTIONS>
- "Babble"
- <BABBLE-SORT>
- "End.teleconference"
- <OFFTELECON>
- "Grade"
- <GRADE.STUFF>
- "Load.players"
- <NEW-LOSS>
- "Load.scores"
- <MOBY-VEC>
- "Make"
- <MAKE.QUESTIONS>
- "No.simple"
- <COND (<SETG IGNORE-SIMPLE <NOT ,IGNORE-SIMPLE>>
- <PRINC "
- Ignore simple questions">)
- (<PRINC "
- Read simple questions">)>
- "Peek"
- <TVPEEK>
- "Print.score"
- <PSCORES>
- "Question.print"
- <PRINT.QSCORE T T>
- "Quit"
- <QUIT>
- "Read.mail"
- <READ.MAIL>
- "Safety"
- <COND (<SETG BUFSAFE <NOT ,BUFSAFE>> <PRINC "
- Safe">)
- (<PRINC "
- Sorry">)>
- "Save.tailor"
- <SAVE-TAILOR>
- "Send.mail"
- <SEND.MAIL>
- "Sequence"
- <GET-SEQUENCE>
- "Shout"
- <SHOUT>
- "Simple.load"
- <LOAD.SIMPLE ,PLAYER>
- "Simple.print"
- <PRINT.SIMPLE>
- "Simple.update"
- <UPDATE.QUESTION <>>
- "Status.of.question"
- <PRINT.QSCORE>
- "Summary.status.of.question"
- <PRINT.QSCORE <>>
- "Teleconference"
- <DO-TELECON>
- "Tiny.babble"
- <BABBLE-SORT T>
- "Update.question"
- <UPDATE.QUESTION>
- "Verbosity"
- <COND (<SETG VERBOSE <NOT ,VERBOSE>> <PRINC "
- Verbose">)
- (<PRINC "
- Unverbose">)>]>>
- <SETG BUFSAFE <>>
- <SETG DCOMS <MAKESST "DCOM" []>>
- <SETG MCOMS <MAKEMST "MCOM" [,COMS ,DCOMS]>>
- <SETG DCOM
- '["Recurse"
- <RECURSE>
- "Play"
- <PLAY>
- "Erret"
- <DO-ERRET>
- "Evaluate"
- <DO-EVAL>]>
- <DEFINE DO-ERRET () <ERRET <READER [] "" "" ["ANY"] <>>>>
- <DEFINE DO-EVAL () <EVAL <READER [] "" "" ["ANY"] <>>>>
- <SETG DEBUGSW <>>
- <DEFINE DEBUG () <PUT ,DCOMS 2 ,DCOM> <SETG DEBUGSW T>>
- <SETG DSKDATE
- %<FIXUP!-RSUBRS '[
- #CODE ![23751557122 23085678677 25614352384 4701028359 -26289897472 17188483128
- 23085698016 *400000000000* -14200726235 -34091302910 2 5804174166 0 262146!]
- DSKDATE
- #DECL ("VALUE" WORD)]
- '(53
- FINIS!-MUDDLE
- 229461
- (2)
- $TLOSE!-MUDDLE
- 225280
- (6)
- MPOPJ!-MUDDLE
- 248800
- (7))>>
- <AND <ASSIGNED? GLUE>
- .GLUE
- <PUT ,DSKDATE GLUE '![17448304640 2!]>>
- <SETG FLUSH <>>
- <SETG QTYPES
- <MAKEBST "QT"
- '["Command"
- 1
- "Joint"
- 8
- "Long Answer"
- 2
- "Matching"
- 3
- "Multiple Choice"
- 4
- "None"
- 0
- "Quit"
- 6
- "Simple"
- 7
- "True/False"
- 5]>>
- <SETG CATS
- <MAKEBST "CAT"
- '["Athletics"
- 1
- "Cinema"
- 2
- "Events"
- 3
- "General"
- 4
- "History"
- 5
- "Literature"
- 6
- "Music"
- 7
- "Science Fiction"
- 8
- "TV/Radio"
- 9]>>
- <DEFINE QUESTIONABLE? (STR)
- #DECL ((STR) STRING)
- <NOT <MAPF <>
- <FUNCTION (X) <COND (<G? <ASCII .X> 32> <MAPLEAVE T>)>>
- .STR>>>
- <DEFINE TP (QUESTION) ;"Hack to get Q's to print evenly"
- #DECL ((QUESTION) STRING)
- <COND (<L=? <14 .OUTCHAN> 40> <PUT .OUTCHAN 14 41>)>
- .QUESTION>
- <DEFINE UNTASTEFUL-CODE (Q "OPTIONAL" (GST <>) "AUX" (IDX 0))
- <MAPF ,VECTOR
- <FUNCTION (X)
- <SET IDX <+ .IDX 1>>
- <COND (<AND <1? .IDX> .GST>
- <MAPRET 2
- ,MATCH-HACK
- <STRING <UNPARSE .IDX> ". " .X>
- 0>)>
- <MAPRET <STRING <UNPARSE .IDX> ". " .X>
- <COND (.GST 0) (.IDX)>>>
- .Q>>
- <DEFINE FLUSH-EM ()
- <COND (<TYPE? ,FLUSH FIX> <OUT ,FLUSH>)
- (<==? ,FLUSH SHOUT> <SETG FLUSH <>> <PRINT.SHOUT>)
- (T
- <OUT <MOD <RANDOM <CHTYPE <TIME> FIX> <FIX <SIN <TIME>>>> 20>>)>>
- <DEFINE OUT ("OPTIONAL" (DELAY 10.000))
- #DECL ((DELAY) <SPECIAL <OR FIX FLOAT>>)
- <SET-STATUS ,$SFLUSH>
- <OFF "CHAR" ,INCHAN>
- <INT-LEVEL 999>
- <ON "CLOCK"
- <FUNCTION ("AUX" (D .DELAY))
- <AND <0? <- .D <FIX .D>>>
- <PRINC "TRIVIA going down in ">
- <PRIN1 <FIX .D>>
- <PRINC <COND (<1? .D> " second.") (" seconds.")>>
- <CRLF>>
- <SET DELAY <- .D 0.500>>>
- 1000>
- <SLEEP .DELAY>
- <VALRET ":KILL
- :
- TRIVIA DOWN!
- ">>
- <DEFINE PRINT.SHOUT ("AUX" (MSG
- <DATA-AREAD ,TVASS ,SHOUTMSG <ARESET ,TVSPACE>>))
- #DECL ((MSG) <VECTOR STRING STRING>)
- <CRLF>
- <CRLF>
- <CRLF>
- <IMAGE 7>
- <IMAGE 7>
- <IMAGE 7>
- <PRINC "Message from ">
- <PRINC <1 .MSG>>
- <CRLF>
- <PRINC <2 .MSG>>
- <CRLF>>
- <DEFINE SHOUT ("AUX" MSG ID (TVA ,TVASS) (TVS ,TVSPACE))
- #DECL ((MSG) STRING (ID) <OR FALSE MANIAC> (TVA) ASYLUM)
- <COND (<MEMBER ,PLAYER ,WINNERS>
- <SET MSG <GETBUF "Message: ">>
- <COND (<NOT <QUESTIONABLE? .MSG>>
- <COND (<SET ID <DATA-OPEN "PRINT" .TVA ,SHOUTMSG>>
- <DATA-IPRINT .TVA
- .ID
- .TVS
- <AVECTOR <ARESET .TVS>
- <ACOPY .TVS ,PLAYER>
- <ACOPY .TVS .MSG>>>
- <SEND-TRIVIAS SHOUT>
- <DATA-CLOSE .TVA .ID>)
- (<CRLF>
- <PRINC
- "The right hand knows not what the left hand does.">
- <CRLF>)>)>)>>
- <DEFINE FLUSH-ALL ("OPTIONAL" (GRACE 10) "AUX" CH)
- #DECL ((GRACE) FIX (CH) <OR CHANNEL FALSE>)
- <COND (<MEMBER ,PLAYER ,WINNERS>
- <CRLF>
- <VALRET ":COPY AR1:MARC;TS TVDOWN,SYS;TS TRIVIA
- :CONTIN
- ">
- <AND <SET CH <OPEN "PRINT" "_MSGS_;TRIVIA DEBUG">>
- <CLOSE .CH>>
- <SEND-TRIVIAS .GRACE>)
- (<QUIT>)>>
- <DEFINE SEND-TRIVIAS (WHAT?
- "AUX" (PG ,PG) (UV ,FOOUV) (SENDER ,PLAYER)
- (MSG <STRING "<SETG FLUSH " <UNPARSE .WHAT?> ">">))
- #DECL ((PG) FIX (UV) <UVECTOR [4 FIX]> (SENDER MSG) STRING)
- <SET-STATUS ,$SHOUT>
- <REPEAT ((N 0) (LOC <+ .PG ,PEEK-START>) LOSER)
- #DECL ((N LOC) FIX (LOSER) STRING)
- <COND (<G? .N 83> <RETURN>)
- (<AND <GET-LOC .LOC .UV> <0? <1 .UV>>>
- <COND (<=? <SET LOSER <SIXTOS <2 .UV>>> .SENDER>)
- (T
- <SEND .LOSER "TRIVIA" .MSG *400000000000*>
- <PRINC .LOSER>
- <CRLF>)>)>
- <SET N <+ .N 1>>
- <SET LOC <+ .LOC 4>>>>
- <SETG GIVEUP <MAKESST "GIVE" ["
- Give up (CR)" <>]>>
- <SETG SYMTAB <MAKESST "SYMS" []>>
- <SETG ALLSYMS <MAKEMST "ALLSYMS" [,GIVEUP ,SYMTAB]>>
- <SETG ALWAYS-ANSWER <>>
- <SETG KEEPASKING <>>
- <SETG IGNORE-SIMPLE <>>
- <SETG NEW-MATCH <>>
- <SETG T/F <MAKESST "T/F" ["Yes" T "No" <>]>>
- <DEFINE TRUE? (STR1 STR2 TRUELST FALSELST "OPTIONAL" INTCHR "AUX" CHR)
- #DECL ((STR1 STR2) STRING (INTCHR CHR) CHARACTER (TRUELST) LIST)
- <PROG ()
- <PRINC .STR1>
- <RESET ,INCHAN>
- <PRINC " (">
- <PRINC .STR2>
- <PRINC ") ">
- <SET CHR <TYI>>
- <COND (<AND <ASSIGNED? INTCHR> <==? .CHR .INTCHR>>
- <INTERRUPT "CHAR" .INTCHR ,INCHAN>)>
- <COND (<MEMQ .CHR .TRUELST>)
- (<MEMQ .CHR .FALSELST> <>)
- (<AGAIN>)>>>
- <DEFINE SEND-PLAYER (WHO WHAT
- "OPTIONAL" (WHR ,ALAST) (MUNG-SLOT? <>)
- "AUX" (TVS ,TVSPACE2) (TVA ,TVASS) (TTUV ,TTUV) NUTS LAST
- NEW (RETRY? T) LOC)
- #DECL ((WHO) STRING (WHAT) ANY (TVS) SPACE (NUTS) LIST (LOC LAST WHR) FIX
- (TVA) ASYLUM (MUNG-SLOT) <OR FIX FALSE> (NEW) <OR FALSE MANIAC>
- (RETRY?) <OR ATOM FALSE> (TTUV) <UVECTOR FIX>)
- <COND (<=? ,PLAYER "DEBUG">)
- (<SET NUTS <GET-LOSER .WHO>>
- <SET LAST <+ .WHR <3 .NUTS>>>
- <COND (.MUNG-SLOT?
- <SET LOC <+ ,PG <* 4 <4 .NUTS>> .MUNG-SLOT?>>
- <UNWIND <PROG ()
- <COND (<DHLOCK .LOC>
- <GET-LOC .LOC .TTUV>
- <PUT .TTUV 1 <CHTYPE <4 .WHAT> FIX>>
- <PUT-LOC <+ .LOC 1> .TTUV>
- <DUNLOCK .LOC>)
- (<SLEEP 2> <AGAIN>)>>
- <DUNLOCK .LOC>>)>
- <COND (<CHAIN-APPEND .TVA .TVS .WHAT .LAST>
- <CRLF>
- <PRINC "Sent.">)
- (<PERR "SEND-PLAYER FAILURE -- PLEASE REPORT TO MARC">)>)>>
- <DEFINE NEW-LOSS ("AUX" NUTS)
- #DECL ((NUTS) <OR LIST FALSE>)
- <GUNASSIGN PLAYER-SYMS>
- <COND (<SET NUTS <DATA-AREAD ,TVASS ,LUSERS <ARESET ,LOSSSPACE>>>
- <SETG LOSSTABLE .NUTS>
- .NUTS)
- (T
- <PERR "Can't read losstable--your TRIVIA is DEAD"
- .NUTS
- NEW-LOSS>)>>
- <DEFINE CHAIN-APPEND (TVA TVS WHAT CHAIN "AUX" OINT)
- #DECL ((TVA) ASYLUM (TVS) SPACE (WHAT) ANY (OINT CHAIN) FIX)
- <SET OINT <INT-LEVEL 20>>
- <PROG (FROB HIA WHR RETVAL)
- #DECL ((FROB HIA) <OR FALSE MANIAC> (RETVAL WHR) FIX)
- <COND (<SET FROB <DATA-APRINT .TVA -1 .TVS .WHAT>>
- <OR <0? <CHTYPE <DATA-READW .TVA <SET RETVAL <1 .FROB>>>
- FIX>>
- <AND <INT-LEVEL 0>
- <PERR "Non-zero chain pointer"
- CHAIN-APPEND
- .FROB>>>
- <COND (<AND <SET HIA <DATA-OPEN "PRINTW" .TVA .CHAIN>>
- <SET WHR <CHTYPE <DATA-READW .TVA .CHAIN> FIX>>
- <DATA-PRINTW .TVA .WHR .RETVAL>
- <DATA-PRINTW .TVA .HIA .RETVAL>>
- <INT-LEVEL .OINT>
- .RETVAL)
- (<AND <NOT .HIA> <MEMQ <1 .HIA> '(5 6)>>
- <STALL <1 .HIA>>
- <AGAIN>)
- (<PERR "Can't CHAIN-APPEND" .FROB .HIA>)>)
- (<MEMQ <1 .FROB> '(5 6)> <STALL <1 .FROB>> <AGAIN>)
- (<INT-LEVEL 0>
- <PERR "Can't PRINT append, CHAIN-APPEND" .FROB>)>>>
- <DEFINE STALL (WHY)
- <PRINC "
- NON-FATAL TIME OUT, STALLING BECAUSE --">
- <PRINC <NTH ,ERRORS .WHY>>
- <SLEEP 4>>
- <DEFINE GET-LOSER (PLAYER "AUX" (NUTS ,LOSSTABLE) OINT)
- #DECL ((PLAYER) STRING (NUTS) <OR LIST FALSE> (OINT) FIX)
- <SET OINT <INT-LEVEL 20>>
- <COND (<SET NUTS <MEMBER .PLAYER .NUTS>>)
- (<SET NUTS <NEW-LOSS>>
- <COND (<SET NUTS <MEMBER .PLAYER .NUTS>>)
- (<PERR "Player does not exist!!" .PLAYER GET-LOSER>)>)>
- <INT-LEVEL .OINT>
- .NUTS>
- <DEFINE ADDSCORE (WHO QUES AMT
- "AUX" (NUTS <GET-LOSER .WHO>) (TVA ,TVASS) (TVS ,TVSPACE1) ID
- SCORE SCUVEC LBLK M CATSCR OINT)
- #DECL ((WHO) STRING (QUES) VECTOR (AMT) <OR FIX FLOAT> (TVA) ASYLUM
- (NUTS) LIST (TVS) SPACE (ID) <OR MANIAC FALSE> (SCORE) WORD
- (SCUVEC) <UVECTOR [REST <UVECTOR FLOAT FLOAT>]> (M) <OR FALSE LIST>
- (LBLK) FIX (CATSCR) <UVECTOR FLOAT FLOAT>)
- <COND
- (<=? ,PLAYER "DEBUG">)
- (<SET OINT <INT-LEVEL 20>>
- <COND
- (<SET ID <DATA-OPEN "PRINTW" .TVA <NTH .QUES ,QSCORE>>>
- <SET SCORE <DATA-READW .TVA <1 .ID>>>
- <SET SCORE
- <PUTBITS .SCORE
- <BITS 18 18>
- <CHTYPE <+ 1 <CHTYPE <GETBITS .SCORE <BITS 18 18>> FIX>>
- WORD>>>
- <DATA-PRINTW
- .TVA
- .ID
- <PUTBITS .SCORE
- <BITS 18 0>
- <CHTYPE <+ <FIX <* 1000 .AMT>>
- <CHTYPE <GETBITS .SCORE <BITS 18 0>> FIX>>
- WORD>>>)
- (<INT-LEVEL 0> <PERR "Can't update QUESTION-SCORE" .QUES>)>
- <SET LBLK <3 .NUTS>>
- <PROG (QVAL (TBUV ,TBUV) (TINDEX <4 .NUTS>)
- (LOC <+ ,PG ,BABBLE-START <* 4 .TINDEX>>))
- #DECL ((QVAL) FLOAT (TBUV) <UVECTOR [4 FIX]> (TINDEX LOC) FIX)
- <COND
- (<SET ID <DATA-OPEN "PRINT" .TVA <+ .LBLK ,SCORE>>>
- <SET SCUVEC <DATA-IREAD .TVA .ID <ARESET .TVS>>>
- <SET CATSCR <NTH .SCUVEC <NTH .QUES ,QCAT>>>
- <PUT .CATSCR 1 <FLOAT <+ .AMT <1 .CATSCR>>>>
- <PUT .CATSCR
- 2
- <+ <SET QVAL <FLOAT <NTH .QUES ,QVAL>>> <2 .CATSCR>>>
- <DATA-IPRINT .TVA .ID .TVS .SCUVEC>
- <PROG ()
- <COND (<DHLOCK .LOC>
- <GET-LOC .LOC .TBUV>
- <PUT .TBUV
- 3
- <CHTYPE <+ <CHTYPE <3 .TBUV> FLOAT> <FLOAT .AMT>>
- FIX>>
- <PUT .TBUV
- 4
- <CHTYPE <+ <CHTYPE <4 .TBUV> FLOAT> .QVAL> FIX>>
- <PUT-LOC .LOC .TBUV>
- <DUNLOCK .LOC>)
- (<SLEEP 2> <AGAIN>)>>
- <DATA-CLOSE .TVA .ID>)
- (<MEMQ <1 .ID> '(5 6)> <STALL <1 .ID>> <AGAIN>)
- (<INT-LEVEL 0>
- <PERR "Can't update PLAYER-SCORE" .WHO .AMT .NUTS>)>>
- <INT-LEVEL .OINT>)>>
- <DEFINE PERR (STR "TUPLE" ARG)
- #DECL ((STR) STRING (ARG) TUPLE)
- <SET-STATUS ,$SERROR>
- <CRLF>
- <PRINC "ERROR, ">
- <PRINC .STR>
- <PRINC ". Please report to ">
- <PRINC ,MAINT>
- <SETG REP ,SAVEREP>
- <ERROR TRIVIA-LOSSAGE!-ERRORS !.ARG>>
- <SETG MAINT "MARC or TAA">
- <SETG WHOSYMS <MAKESST "FOO" []>>
- <DEFINE P-SYMS ("AUX" (NUTS ,LOSSTABLE) (CURSPACE ,LOSSSPACE))
- #DECL ((NUTS) LIST (CURSPACE) <SPECIAL SPACE>)
- <COND (<GASSIGNED? PLAYER-SYMS> ,PLAYER-SYMS)
- (<SETG PLAYER-SYMS
- <PUT ,WHOSYMS
- 2
- <MAPR ,ALVECTOR
- <FUNCTION (X)
- <COND (<==? 1 <1 .X>> <MAPRET>)
- (<AND <TYPE? <1 .X> STRING>
- <NOT <TYPE? <2 .X> FIX>>>
- <MAPRET <1 .X> <3 .X>>)
- (<MAPRET>)>>
- .NUTS>>>)>>
- <DEFINE SEND.MAIL ("AUX" (TVS <ARESET ,TVSPACE2>) WHO LST MSG)
- #DECL ((TVS) SPACE (WHO) <OR FALSE VECTOR> (LST) <LIST [REST SYMBOL]>
- (MSG) STRING)
- <COND
- (<SET WHO <READARGS <P-SYMS> "To" '["" ""] '["SYM" "MULT"]>>
- <COND (<EMPTY? <SET LST <1 .WHO>>>)
- (<SET MSG <GETBUF "Message: ">>
- <MAPF <>
- <FUNCTION (X)
- <SEND-PLAYER <1 .X>
- <AVECTOR .TVS
- .MSG
- 1
- <ACOPY .TVS ,PLAYER>
- <DSKDATE>>
- ,MLAST
- ,TELEC-START>>
- .LST>)>)>>
- <DEFINE CHAIN-FOLLOW (APP FROM TO
- "AUX" (TVA ,TVASS)
- (LO <CHTYPE <DATA-READW .TVA <+ ,LUBLK .FROM>> FIX>)
- (TVS <ARESET ,TVSPACE>) MAIL NEXT)
- #DECL ((TVA) ASYLUM (LO FROM TO) FIX (TVS) SPACE
- (MAIL) <OR FALSE VECTOR> (NEXT) WORD
- (APP) <VECTOR [REST APPLICABLE]>)
- <COND (<0? .LO> #FALSE ())
- (<SET MAIL <DATA-AREAD .TVA .LO .TVS>>
- <APPLY <NTH .APP <NTH .MAIL ,ATYPE>> .MAIL>
- <DATA-PRINTW .TVA
- <+ ,LUBLK .FROM>
- <SET NEXT <DATA-READW .TVA .LO>>>
- <COND (<==? .NEXT #WORD *000000000000*>
- <DATA-PRINTW .TVA <+ ,LUBLK .TO> <+ ,LUBLK .FROM>>)>
- <DATA-DELETE .TVA .LO>)>>
- <DEFINE VERBOHACK ("TUPLE" TUP)
- <CRLF>
- <COND (<SETG KEEPASKING <NOT ,KEEPASKING>>
- <PRINC "Continuous questions mode">
- <AND <ASSIGNED? topask>
- <LEGAL? .topask>
- <RETURN T .topask>>)
- (<PRINC "One at a time mode">)>
- <CRLF>>
- <DEFINE ANSHACK ()
- <CRLF>
- <COND (<SETG ALWAYS-ANSWER <NOT ,ALWAYS-ANSWER>>
- <PRINC "Always give answer mode">
- <AND <ASSIGNED? topask>
- <LEGAL? .topask>
- <RETURN T .topask>>)
- (<PRINC "Dont give answers">)>
- <CRLF>>
- <DEFINE ANSWERHACK ("TUPLE" X)
- <PROG ()
- <COND (<AND <ASSIGNED? Q.A>
- <ASSIGNED? BUF>
- <==? <NTH .Q.A ,QTYPE> ,$TLONG>>
- <ADDSTRING .BUF <NTH .Q.A 10>>
- <PRINC "[Answer added]">)
- (<ANSHACK>)>>>
- <DEFINE CHAR-INIT ()
- <CALRDRINIT>
- <SETG SPCCHARS <STRING <ASCII 22> !,SPCCHARS>>
- <SET FOO <MEMQ <ASCII 12> .CHRTABLE>>
- <PUT .FOO 2 ,BUFHACK>
- <SET CHRTABLE
- [<ASCII 20> ,ANSWERHACK <ASCII 22> ,VERBOHACK !.CHRTABLE]>
- <SET FOO <MEMQ <ASCII 12> ,XSPCCHARS>>
- <PUT .FOO 2 '<CLEAR>>
- <SETG XSPCCHARS
- [<ASCII 20> '<ANSHACK> <ASCII 22> '<VERBOHACK> !,XSPCCHARS]>
- <ON "CHAR" ,CHARINT 8 0 ,INCHAN>>
- <DEFINE CLEAR ()
- <PRINC "C">
- <COND (<ASSIGNED? QUESTION?>
- <PQHEADER .QUESTION?>
- <COND (<==? <NTH .QUESTION? ,QTYPE> ,$TMATCH>
- <MATCH-PRINT <REST .QUESTION? ,QQUES>>)
- (<PRINC <NTH .QUESTION? <+ ,QQUES 1>>>)>)
- (<ASSIGNED? Q.A>
- <TERPRI>
- <PRINC "Answer from ">
- <PRINC <NTH .A ,AAUTH>>
- <PRINC ": ">
- <PRINC <NTH .A ,ARESP>>)>
- <COND (<GASSIGNED? MATCH>
- <TERPRI>
- <PRINC "Match ">
- <PRINC ,MATCH>)
- (<ASSIGNED? MARKING>
- <PRINC "
- Score (out of ">
- <PRIN1 .MARKING>
- <PRINC ")">)>
- <RETYPE-BUFFER!-ICALRDR T>>
- <DEFINE CHARINT (CHR CHN)
- #DECL ((CHR) CHARACTER (CHN) CHANNEL)
- <INT-LEVEL 0>
- <COND (<==? .CHR <ASCII 7>>
- <COND (<MEMBER ,PLAYER ,WINNERS> <RECURSE> <DISMISS T>)
- (<DISMISS T>)>)
- (<==? .CHR <ASCII 22>> <VERBOHACK>)
- (<==? .CHR <ASCII 20>> <ANSHACK>)>>
- <DEFINE BUFHACK (BUF CHR)
- #DECL ((CHR) CHARACTER (BUF) BUFFER)
- <PRINC "C">
- <AND <ASSIGNED? QUESTION?> <PQHEADER .QUESTION?>>
- <COND (<ASSIGNED? qprompt> <PRINC .qprompt> <CRLF>)>
- <COND (<ASSIGNED? bprompt> <PRINC .bprompt>)>
- <COND (<ASSIGNED? aprompt>
- <PRINC .aprompt>
- <TERPRI>
- <PRINC "Correct answer">)>
- <AND ,VERBOSE <PRINC " (BUFFER): ">>
- <IBUFPRINT .BUF <ASCII 4>>>
- <SETG SCOREVEC <IVECTOR 2 0>>
- <DEFINE GETQSCORE (QLOC "AUX" (SCWD <DATA-READW ,TVASS .QLOC>) (SV ,SCOREVEC))
- #DECL ((QLOC) FIX (SCWD) WORD (SV) <VECTOR [2 <OR FIX FLOAT>]>)
- <PUT .SV 1 <CHTYPE <GETBITS .SCWD <BITS 18 18>> FIX>>
- <PUT .SV
- 2
- </ <CHTYPE <GETBITS .SCWD <BITS 18 0>> FIX> 1000.000>>>
- <DEFINE PQSCORE (QLOC QMAX
- "OPTIONAL" (SV <GETQSCORE .QLOC>) (MX <* <1 .SV> .QMAX>)
- "AUX")
- #DECL ((QLOC) FIX (MX QMAX) <OR FIX FLOAT>
- (SV) <VECTOR [2 <OR FIX FLOAT>]>)
- <PRIN1 <1 .SV>>
- <PRINC " players received ">
- <PRIN1 <2 .SV>>
- <PRINC " points of maximum ">
- <PRIN1 .MX>
- <PRINC " [">
- <PRIN1 <FIX </ <* 100 <2 .SV>> .MX>>>
- <PRINC "%]">
- .SV>
- <DEFINE GETSCORE (PLAYER "AUX" (TVA ,TVASS) (TVS ,TVSPACE1) NUTS WHR)
- #DECL ((PLAYER) STRING (TVA) ASYLUM (TVS) SPACE (NUTS) LIST (WHR) FIX)
- <SET WHR
- <+ ,SCORE
- <COND (<=? .PLAYER ,PLAYER> ,LUBLK)
- (<SET NUTS <GET-LOSER .PLAYER>> <3 .NUTS>)>>>
- <DATA-AREAD .TVA .WHR <ARESET .TVS>>>
- <DEFINE PSCORE (PLAYER
- "AUX" SCUVEC (TVS ,TVSPACE1) (TVA ,TVASS) (N 1) (TOT 0)
- (SCTOT 0) (QTOT 0) QTEMP QASKED LUBLK NSC NSC1)
- #DECL ((PLAYER) STRING (SCUVEC) UVECTOR (QTEMP QTOT N) FIX (TVA) ASYLUM
- (TVS) SPACE (TOT SCTOT) <OR FIX FLOAT> (NSC NSC1) FLOAT
- (QASKED) <VECTOR [REST LIST]> (LUBLK) FIX)
- <SET SCUVEC <GETSCORE .PLAYER>>
- <SET QASKED
- <DATA-AREAD .TVA
- <+ <SET LUBLK <3 <MEMBER .PLAYER ,LOSSTABLE>>> ,QASKED>
- .TVS>>
- <MAPF <>
- <FUNCTION (X)
- #DECL ((X) <OR STRING FIX>)
- <COND (<TYPE? .X STRING>
- <CRLF>
- <PRINC .X>
- <INDENT-TO 19>
- <PRIN1 <SET NSC <1 <1 .SCUVEC>>>>
- <SET SCTOT <+ .SCTOT .NSC>>
- <INDENT-TO 33>
- <PRIN1 <SET NSC1 <2 <1 .SCUVEC>>>>
- <SET TOT <+ .TOT .NSC1>>
- <SET N <+ .N 1>>
- <INDENT-TO 47>
- <COND (<==? .NSC1 0.000> <PRINC "---">)
- (T <PRIN1 </ .NSC .NSC1>>)>
- <SET SCUVEC <REST .SCUVEC>>
- <INDENT-TO 61>
- <PRIN1 <SET QTEMP </ <LENGTH <1 .QASKED>> 2>>>
- <SET QTOT <+ .QTEMP .QTOT>>
- <SET QASKED <REST .QASKED>>)>>
- <2 ,CATS>>
- <CRLF>
- <PRINC "Total of ">
- <PRIN1 .SCTOT>
- <PRINC " points out of ">
- <PRIN1 .TOT>
- <PRINC " [">
- <PRIN1 <FIX </ <* 100 .SCTOT> .TOT>>>
- <PRINC "%]. ">
- <PRIN1 .QTOT>
- <PRINC " questions.">
- <CRLF>
- <PRINC "Progress: ">
- <PRIN1 <GETLASTQ .LUBLK>>>
- <DEFINE GETLASTQ (LUBLK "AUX" (TVS ,TVSPACE1) Q LOWQ)
- #DECL ((LOWQ LUBLK) FIX (Q) <OR FALSE <VECTOR FIX [REST ANY]>>)
- <COND (<==? <SET LOWQ
- <CHTYPE <DATA-READW ,TVASS <+ .LUBLK ,QNEXT>> FIX>>
- ,LOWQUES>
- 0)
- (<SET Q <DATA-AREAD ,TVASS .LOWQ <ARESET .TVS>>>
- <QQNUM .Q>)>>
- <DEFINE PDSKDATE (WD
- "AUX" (TIM <CHTYPE <GETBITS .WD <BITS 18 0>> FIX>)
- (A/P " AM ") HR)
- #DECL ((WD) WORD (TIM HR) FIX (A/P) STRING)
- <PRINC " ">
- <PRINC <NTH ,MONTHS <CHTYPE <GETBITS .WD <BITS 4 23>> FIX>>>
- <PRINC " ">
- <PRIN1 <CHTYPE <GETBITS .WD <BITS 5 18>> FIX>>
- <PRINC " at ">
- <SET HR </ .TIM 7200>>
- <COND (<G=? .HR 12> <SET HR <- .HR 12>> <SET A/P " PM ">)>
- <COND (<0? .HR> <SET HR 12>)>
- <PRIN1 .HR>
- <PRINC ":">
- <SET HR </ <MOD .TIM 7200> 120>>
- <COND (<L? .HR 10> <PRINC "0">)>
- <PRIN1 .HR>
- <PRINC .A/P>>
- <SETG MONTHS
- ["January"
- "February"
- "March"
- "April"
- "May"
- "June"
- "July"
- "August"
- "September"
- "October"
- "November"
- "December"]>
- <GDECL (MONTHS) <VECTOR [12 STRING]>>
- <DEFINE ANNOUNCE ("AUX" (TVS <ARESET ,TVSPACE2>) (TVA ,TVASS) ANN)
- #DECL ((TVA) ASYLUM (TVS) SPACE (ANN) STRING)
- <COND (<AND <PRINC
- "
- [PLEASE ONLY MAKE ANNOUNCEMENTS IF REALLY NECESSARY
- TYPE ALTMODE TO FLUSH THIS COMMAND]
- ">
- <SET ANN <GETBUF "Announcement: ">>
- <NOT <QUESTIONABLE? .ANN>>>
- <CHAIN-APPEND .TVA
- .TVS
- <AVECTOR .TVS <DSKDATE> <ACOPY .TVS ,PLAYER> .ANN>
- ,HIMAIL>)>>
- <DEFINE READ.ANNOUNCE ("AUX" (TVA ,TVASS) (TVS <ARESET ,TVSPACE>) ANN
- (NXT
- <CHTYPE <DATA-READW .TVA <+ ,LUBLK ,ANNEXT>>
- FIX>))
- #DECL ((TVA) ASYLUM (NXT) FIX (TVS) SPACE (ANN) <OR FALSE VECTOR>)
- <REPEAT ()
- <COND (<0? <SET NXT <CHTYPE <DATA-READW .TVA .NXT> FIX>>>
- <RETURN>)
- (<SET ANN <DATA-AREAD .TVA .NXT .TVS>>
- <PRINC "
- From ">
- <PRINC <2 .ANN>>
- <PDSKDATE <1 .ANN>>
- <CRLF>
- <PRINC <3 .ANN>>
- <SET DAT <DSKDATE>>
- <COND (<==? <GETBITS .DAT <BITS 4 23>>
- <GETBITS <1 .ANN> <BITS 4 23>>>
- <AND <G? <- <CHTYPE <GETBITS .DAT <BITS 5 18>> FIX>
- <CHTYPE <GETBITS <1 .ANN> <BITS 5 18>>
- FIX>>
- 14>
- <DELETE.ANNOUNCE .NXT>>)
- (<G? <- <+ <CHTYPE <GETBITS .DAT <BITS 5 18>> FIX> 30>
- <CHTYPE <GETBITS <1 .ANN> <BITS 5 18>> FIX>>
- 14>
- <DELETE.ANNOUNCE .NXT>)>)>
- <DATA-PRINTW .TVA <+ ,LUBLK ,ANNEXT> .NXT>>>
- <DEFINE DELETE.ANNOUNCE (WHR "AUX" DAT LOC)
- #DECL ((WHR LOC) FIX (DAT) <UVECTOR [4 WORD]>)
- <SET DAT <DATA-FIND ,TVASS .WHR>>
- <SET LOC <CHTYPE <NTH .DAT <+ ,NAMDATA 1>> FIX>>
- <PUT .DAT 2 #WORD *000000000000*>
- <PUT .DAT 3 #WORD *000000000000*>
- <DATA-PUT ,TVASS .WHR .DAT>
- <DATA-BLOCK-FREE ,TVASS .LOC>>
- <DEFINE COMREP () <SETG SAVEREP ,REP> <SETG REP ,COMMAND>>
- <DEFINE RECURSE () <SETG REP ,SAVEREP> <LISTEN> <SETG REP ,COMMAND>>
- <DEFINE ANSWER? ()
- <OR ,ALWAYS-ANSWER
- <PROG topask ()
- #DECL ((topask) <SPECIAL ACTIVATION>)
- <TRUE? "
- Want the answer "
- "Y/N"
- '(!"Y !"y)
- '(!"N !"n)
- <ASCII 20>>>>>
- <DEFINE FLOATPRINT (FLT "AUX" DEC X1000)
- #DECL ((FLT) FLOAT (DEC X1000) FIX)
- <COND (<==? <MOD <SET X1000 <FIX <* 1000 .FLT>>> 10> 9>
- <SET X1000 <+ .X1000 1>>)>
- <PRIN1 </ .X1000 1000>>
- <PRINC ".">
- <SET DEC <MOD .X1000 1000>>
- <AND <L? .DEC 100> <PRINC !"0>>
- <AND <L? .DEC 10> <PRINC !"0>>
- <PRINC .DEC>>
- <PRINTTYPE FLOAT ,FLOATPRINT>
- <OVERFLOW <>>
- <DEFINE TVSAVE (VER DBG "OPTIONAL" (MOD 0) "AUX")
- #DECL ((DBG) <OR 'T FALSE> (VER MOD) FIX)
- <CHAR-INIT>
- <AND .DBG <DEBUG>>
- <FUMP .VER ,SAVE .MOD>>
- <SETG QSYMS <MAKESST "QSYMS" []>>
- <DEFINE Q-SYMS ("AUX" (TVA ,TVASS) (CURSPACE <ARESET ,TVSPACE>) (IDX 1) WHR)
- #DECL ((TVA) ASYLUM (CURSPACE) <SPECIAL SPACE> (WHR IDX) FIX)
- <COND
- (<SET QPOSS <DATA-AREAD .TVA <+ ,LUBLK ,QASKED> .CURSPACE>>
- <PUT
- ,QSYMS
- 2
- <MAPF ,ALVECTOR
- <FUNCTION (X "AUX" CATNM)
- #DECL ((X) LIST (CATNM) STRING)
- <AND <EMPTY? .X> <SET IDX <+ .IDX 1>> <MAPRET>>
- <SET CATNM <NTH <2 ,CATS> <- <* .IDX 2> 1>>>
- <REPEAT ((Y .X))
- #DECL ((Y) LIST)
- <COND (<EMPTY? .Y> <RETURN>)
- (<SET WHR <1 .Y>>
- <PUT .Y
- 1
- <ASTRING .CURSPACE
- .CATNM
- "."
- <UNPARSE <2 .Y>>>>
- <PUT .Y 2 .WHR>
- <SET Y <REST .Y 2>>)>>
- <SET IDX <+ .IDX 1>>
- <MAPRET !.X>>
- .QPOSS>>)>>
- <DEFINE GET.QUESTION ("OPTIONAL" (MULT <>) "AUX" SYMS SYMV)
- #DECL ((SYMS) <OR FALSE SYMTABLE> (SYMV) <OR FALSE VECTOR>
- (MULT) <OR FALSE 'T>)
- <COND (<SET SYMS <Q-SYMS>>
- <COND (<SET SYMV
- <READARGS .SYMS
- "Question"
- '["" ""]
- <COND (.MULT '["SYM" "MULT"]) ('["SYM"])>>>
- <AND <NOT <EMPTY? <1 .SYMV>>> <1 .SYMV>>)>)
- (<PERR "Can't get QUESTION SYMBOLS, Q-SYMS">)>>
- <GDECL (SIMPLE-SPACE) SPACE>
- <SETG SIMTABLE <MAKESST "SIMTABLE" []>>
- <GDECL (SIMTABLE) <OR FALSE SYMTABLE>>
- <DEFINE GET.SIMPLE ("OPTIONAL" (MULT <>) "AUX" SYMV)
- #DECL ((SYMV) <OR FALSE VECTOR> (MULT) <OR ATOM FALSE>)
- <COND (<NOT <GASSIGNED? SIMPLE-SPACE>>
- <COND (<SETG SIMTABLE <LOAD.SIMPLE ,PLAYER>>)
- (T <PERR "Can't get QUESTION SYMBOLS" GET.SIMPLE>)>)>
- <COND (<SET SYMV
- <READARGS ,SIMTABLE
- "Question"
- '["" ""]
- <COND (.MULT '["SYM" "MULT"]) ('["SYM"])>>>
- <AND <NOT <EMPTY? <1 .SYMV>>> <1 .SYMV>>)>>
- <DEFINE LOAD.SIMPLE (PLAYER
- "AUX" (TVA ,TVASS)
- (CURSPACE
- <COND (<GASSIGNED? SIMPLE-SPACE> ,SIMPLE-SPACE)
- (T <SETG SIMPLE-SPACE <AFIND 1>>)>)
- (TVS ,TVSPACE1) (CQID ,LOWQUES) RES)
- #DECL ((PLAYER) STRING (CURSPACE) <SPECIAL SPACE> (TVS) SPACE (TVA) ASYLUM
- (CQID) FIX (RES) VECTOR)
- <PUT
- ,SIMTABLE
- 2
- <MAPF ,ALVECTOR
- <FUNCTION ()
- <COND
- (<0? <SET CQID <CHTYPE <DATA-READW .TVA .CQID> FIX>>>
- <MAPSTOP>)
- (<SET CQUES <DATA-AREAD .TVA .CQID <ARESET .TVS>>>
- <COND (<AND <==? <QTYPE .CQUES> ,$TSIMPLE>
- <=? <QAUTH .CQUES> .PLAYER>>
- <MAPRET <ASTRING .CURSPACE <UNPARSE <QQNUM .CQUES>>>
- .CQID>)
- (T <MAPRET>)>)
- (<PERR "Can't read question" LOAD.SIMPLE .CQID> <MAPRET>)>>>>>
- <DEFINE PRINT.QSCORE ("OPTIONAL" (PRINT? T) (VERBOSE? <>)
- "AUX" (TVA ,TVASS) (TVS ,TVSPACE) (PL 0) (PS 0.000)
- (MX 0.000) SYML)
- #DECL ((SYML) <OR FALSE <LIST [REST SYMBOL]>> (TVA) ASYLUM (TVS) SPACE
- (PS MX) FLOAT (PL) FIX (PRINT? VERBOSE?) <OR ATOM FALSE>)
- <COND
- (<SET SYML <GET.QUESTION T>>
- <CRLF>
- <MAPF <>
- <FUNCTION (X "AUX" FROB QUES)
- #DECL ((X) SYMBOL (QUES) VECTOR
- (FROB) <VECTOR [2 <OR FIX FLOAT>]>)
- <SET QUES <DATA-AREAD .TVA <2 .X> <ARESET .TVS>>>
- <COND (.PRINT?
- <PQHEADER .QUES>
- <COND (.VERBOSE? <PRINT-QUESTION .QUES>)
- (T <PRINC <NTH .QUES <+ ,QQUES 1>>>)>
- <CRLF>
- <CRLF>
- <SET FROB
- <PQSCORE <NTH .QUES ,QSCORE> <NTH .QUES ,QVAL>>>
- <CRLF>
- <PRINC "------">)
- (<SET FROB <GETQSCORE <NTH .QUES ,QSCORE>>>)>
- <SET PL <+ .PL <1 .FROB>>>
- <SET PS <+ .PS <2 .FROB>>>
- <SET MX <+ .MX <* <NTH .QUES ,QVAL> <1 .FROB>>>>>
- .SYML>
- <AND <NOT <LENGTH? .SYML 1>>
- <CRLF>
- <PRINC "
- Total for all questions...">
- <CRLF>>
- <OR <AND <LENGTH? .SYML 1> <OR .PRINT? .VERBOSE?>>
- <PQSCORE 0 0 <VECTOR .PL .PS> .MX>>)>>
- <DEFINE PSCORES ("AUX" SYMV)
- #DECL ((SYMV) <OR FALSE VECTOR>)
- <SET-STATUS ,$SPSCORE>
- <COND (<SET SYMV
- <READARGS <P-SYMS> "for" '["" ""] '["SYM" "MULT"]>>
- <MAPF <>
- <FUNCTION (X)
- #DECL ((X) SYMBOL)
- <PRINC "
- Score for ">
- <PRINC <1 .X>>
- <INDENT-TO 19>
- <PRINC
- "Points Possible Average Questions">
- <CRLF>
- <PSCORE <1 .X>>>
- <1 .SYMV>>)>>
- <DEFINE GETBUF (bprompt "OPTIONAL" qprompt SPROMPT "AUX" BUF)
- #DECL ((qprompt bprompt) <SPECIAL STRING> (SPROMPT) <OR FALSE STRING>
- (BUF) <SPECIAL BUFFER>)
- <TERPRI>
- <SET BUF <BUFMAKE 20>>
- <AND <ASSIGNED? SPROMPT>
- .SPROMPT
- <ADDSTRING .BUF .SPROMPT>>
- <REPEAT ()
- <COND (,VERBOSE <GETSTR .BUF .CHRTABLE .bprompt " (BUFFER):">)
- (<GETSTR .BUF .CHRTABLE .bprompt>)>
- <COND (,BUFSAFE <AND <CONFIRM> <RETURN>>) (<RETURN>)>>
- <ACOPY ,TVSPACE2 <BUFTOS .BUF>>>
- <DEFINE CONFIRM ()
- <PRINC "[confirm]">
- <AND <RESET ,INCHAN> <==? <TYI> <ASCII 27>>>>
- <DEFINE PLAY-BALL ("AUX" (TWORD <DATA-READW ,TVASS <+ ,LUBLK ,TAILOR>>))
- #DECL ((TWORD) WORD)
- <AND <==? .TWORD #WORD *000000000000*>
- <DATA-PRINTW ,TVASS <+ ,LUBLK ,TAILOR> ,T-DEF>
- <SET TWORD ,T-DEF>>
- <SETG SEQUENCE <GETBITS .TWORD <BITS 27 0>>>
- <MAPF <>
- <FUNCTION (BT SW)
- #DECL ((BT) BITS (SW) ATOM)
- <COND (<==? <GETBITS .TWORD .BT> #WORD *000000000000*>
- <SETG .SW <>>)
- (<SETG .SW T>)>>
- ,BIT-TABLE
- ,SWITCH-TABLE>
- <COND (<0? <SETG TELEC-INTERVAL
- <CHTYPE <GETBITS .TWORD ,TCON-BITS> FIX>>>)
- (<TELECON ,TELEC-INTERVAL>)>
- <MAPF <>
- <FUNCTION (BT)
- #DECL ((BT) BITS)
- <COND (<0? <SET COD <CHTYPE <GETBITS .TWORD .BT> FIX>>>
- <MAPLEAVE T>)
- (<PRINC <NTH ,FROB-NAMES .COD>>
- <EVAL <NTH ,FROBS .COD>>)>>
- ,SEQ-BITS>
- <COMMAND>>
- <SETG SWITCH-TABLE
- '[VERBOSE
- ALWAYS-ANSWER
- PNEWMAIL
- IGNORE-SIMPLE
- KEEPASKING
- BUFSAFE]>
- <SETG BIT-TABLE
- '[#BITS *430100000000*
- #BITS *420100000000*
- #BITS *410100000000*
- #BITS *400100000000*
- #BITS *370100000000*
- #BITS *360100000000*]>
- <SETG TCON-BITS <BITS 6 0>>
- <MANIFEST TCON-BITS>
- <DEFINE SAVE-TAILOR ("AUX" (SEQ ,SEQUENCE))
- #DECL ((SEQ) WORD)
- <MAPF <>
- <FUNCTION (BT SW)
- #DECL ((BT) BITS (SW) ATOM)
- <SET SEQ <PUTBITS .SEQ .BT <COND (,.SW 1) (0)>>>>
- ,BIT-TABLE
- ,SWITCH-TABLE>
- <SET SEQ
- <PUTBITS .SEQ
- ,TCON-BITS
- <COND (<G? ,TELEC-INTERVAL 60> 60) (T ,TELEC-INTERVAL)>>>
- <DATA-PRINTW ,TVASS <+ ,LUBLK ,TAILOR> .SEQ>>
- <DEFINE GET-SEQUENCE ("AUX" SEQ (S #WORD *000000000000*))
- #DECL ((SEQ) <OR FALSE <VECTOR LIST>> (S) WORD)
- <COND (<SET SEQ
- <READARGS ,SEQ-SYMS "will be" '["" ""] '["SYM" "MULT"]>>
- <MAPF <>
- <FUNCTION (BT SYM)
- #DECL ((BT) BITS (SYM) <PRIMTYPE VECTOR>)
- <SET S <PUTBITS .S .BT <2 .SYM>>>>
- ,SEQ-BITS
- <1 .SEQ>>
- <SETG SEQUENCE .S>)>>
- <SETG SEQ-SYMS
- <MAKESST "SS"
- ["Make"
- 1
- "Answer"
- 2
- "Grade"
- 3
- "Read.mail"
- 4
- "Babble"
- 5
- "Print.score"
- 6
- "Status.of.question"
- 7]>>
- <DEFINE SET-STATUS (CODE "OPTIONAL" (FROB 0) "AUX" (PG ,PG) (TU ,TUV))
- #DECL ((PG CODE FROB) FIX (TU) <UVECTOR [4 FIX]>)
- <COND (<GASSIGNED? TINDEX>
- <PUT-LOC <+ ,PEEK-START .PG ,TINDEX>
- <PUT .TU 4 <PUTBITS .FROB <BITS 18 18> .CODE>>>)>>
- <SETG PWINNERS ("MARC " "TAA " "JMB ")>
- <SETG PTTUV <IUVECTOR 1 0>>
- <GDECL (PTTUV) <UVECTOR FIX>>
- <DEFINE TVPEEK ("AUX" (FIRST <>) (PG ,PG) (UV ,FOOUV) FROB CODE NAME
- (PWINNERS ,PWINNERS) (PTTUV ,PTTUV))
- #DECL ((FIRST) <OR 'T FALSE> (PG FROB CODE) FIX (UV) <UVECTOR [4 FIX]>
- (NAME) STRING (PWINNERS) <LIST [REST STRING]> (PTTUV) <UVECTOR FIX>)
- <SET-STATUS ,$SPEEK>
- <REPEAT ((N 0) (LOC <+ .PG ,PEEK-START>) M)
- #DECL ((N LOC) FIX (M) <OR FALSE VECTOR>)
- <COND
- (<G? .N 83> <RETURN>)
- (<AND <GET-LOC .LOC .UV> <0? <1 .UV>>>
- <OR .FIRST
- <PRINC "
- Player Status Entered">>
- <SET FIRST T>
- <CRLF>
- <COND (<0? <2 .UV>>
- <PRINC "HACKER Password">
- <INDENT-TO 27>
- <PDSKDATE <DSKDATE>>)
- (<PRINC <SET NAME <SIXTOS <2 .UV>>>>
- <COND (<MEMBER .NAME .PWINNERS> <PRINC " *">)
- (T <PRINC " ">)>
- <OR <0? <1 <GET-LOC <+ .LOC 338> .PTTUV>>> <PRINC " T">>
- <INDENT-TO 12>
- <COND (<SET M
- <MEMQ <CHTYPE <GETBITS <4 .UV> <BITS 18 18>> FIX>
- ,STATUS-VECTOR>>
- <PRINC <2 .M>>)
- (<PRINC "??">)>
- <INDENT-TO 21>
- <COND (<MEMQ <SET CODE
- <CHTYPE <GETBITS <4 .UV> <BITS 18 18>> FIX>>
- '(9 1)>
- <COND (<0? <SET FROB
- <CHTYPE <GETBITS <4 .UV> <BITS 18>> FIX>>>)
- (<PRINC "#"> <PRIN1 .FROB>)>)
- (<==? .CODE ,$SMAKE>
- <COND (<0? <SET FROB
- <CHTYPE <GETBITS <4 .UV> <BITS 18>> FIX>>>)
- (<PRINC <NTH ,MAKETYPES .FROB>>)>)>
- <INDENT-TO 28>
- <PDSKDATE <CHTYPE <3 .UV> WORD>>)>)>
- <SET N <+ .N 1>>
- <SET LOC <+ .LOC 4>>>
- <CRLF>>
- <SETG TOBRKS " ,
- ">
- <DEFINE BUFLEX (S "OPTIONAL" (BRKS ,TOBRKS) "AUX" (LL ("")) (L .LL) (S1 .S))
- #DECL ((S S1 BRKS) STRING (VALUE LL L) <LIST [REST STRING]>)
- <REPEAT ()
- <COND (<OR <EMPTY? .S1> <MEMQ <1 .S1> .BRKS>>
- <AND <N==? .S .S1>
- <PUTREST .L
- <SET L
- (<SUBSTRUC
- .S
- 0
- <- <LENGTH .S> <LENGTH .S1>>>)>>>
- <AND <EMPTY? .S1> <RETURN <REST .LL>>>
- <SET S <REST .S1>>)>
- <SET S1 <REST .S1>>>>
- <SETG MAKETYPES
- ["ZORK!" "Long" "Match" "M.C." "T/F" "ZORK!" "Simple"]>
- ;"POINTER TO START OF USER BLOCK FOR USER FOO
- SETG'S FOO TO THAT FIX"
- <DEFINE UBLOCK (STR "OPTIONAL" (L ,LOSSTABLE) M)
- #DECL ((STR) STRING (L) LIST (M) <OR LIST FALSE>)
- <COND (<GASSIGNED? <PARSE .STR>> ,<PARSE .STR>)
- (<SET M <MEMBER .STR .L>> <SETG <PARSE .STR> <3 .M>>)>>
- <DEFINE PLAY ("OPTIONAL" (PLAYER <>) "AUX" FOO TINDEX LUBLK)
- #DECL ((PLAYER) <OR STRING FALSE> (FOO) <OR FALSE FIX>)
- <COND (<MEMBER <XUNAME> ,WINNERS>
- <COND (<NOT .PLAYER>
- <SET PLAYER <READER '[] "as " "" '["LINE"] <>>>)>
- <COND (<SET FOO <UBLOCK .PLAYER>>
- <SET TINDEX <* 4 <4 <MEMBER .PLAYER ,LOSSTABLE>>>>
- <COND (<DHLOCK <+ .TINDEX ,PEEK-START ,PG>>
- <DUNLOCK <+ ,TINDEX ,PEEK-START ,PG>>
- <SETG TINDEX .TINDEX>
- <SETG LUBLK .FOO>
- <SETG PLAYER .PLAYER>
- <PUT ,TUV 2 <CHTYPE <STRTOX .PLAYER> FIX>>
- .PLAYER)
- (T <PRINC "Already playing">)>)
- (T <PRINC "You blew it, champ.">)>)>>
- <SETG INDEX
- %<FIXUP!-RSUBRS '[
- #CODE ![23751557122 23085678677 25614352384 4793303046 17188483073 23085698016
- 4980738 2 6302928656 0 262146!]
- INDEX
- #DECL ("VALUE" FIX)]
- '(53
- FINIS!-MUDDLE
- 229461
- (2)
- $TLOSE!-MUDDLE
- 225280
- (5)
- MPOPJ!-MUDDLE
- 248800
- (6))>>
- <AND <ASSIGNED? GLUE>
- .GLUE
- <PUT ,INDEX GLUE '![17448304640 2!]>>
|