2004-10-09 · in Tech Notes · 584 words

Since I haven't written any serious occam in a while, I need a project that'll get me back into it (particularly since I'm supervising some occam classes now). I also want to have a play with the existing interfaces for socket programming in occam.

Conveniently, UKCIRC is in need of a new quiz bot. Having played Monty's quiz game for several years, I, Mark and the other #quiz users have come up with a number of suggestions for improvements. Paul Mutton's kindly sent me a copy of Monty's quiz database.

The obvious project, then, is to write a quiz bot in occam. This'll involve some socket and file IO stuff, and with a bit of luck I'll end up with a generic IRC framework at the end of it that I can use for other things. For example, I'd like to have an IRC bot that monitors the power usage in our house, so we can tell when the tumble dryer's finished.


The occam IRC framework should obviously be called KoIL, for "Kent occam IRC Library".

I keep rough notes in an A4 notebook; it's particularly good for sketching diagrams in, since I'm hopeless at drawing on computers. Here's a sample page: a process diagram for KoIL.

Don't expect to be able to read my writing.

KoIL process diagram


(Thanks to Mark for some of these!)

Ignore punctuation and spacing when checking answers ("A.T.Sampson" is the same as "A T Sampson" and "AT Sampson").

Display clues using hashes instead of hyphens, so that hyphens in answers are visible.

Display punctuation in clues.

Give partial points at the end of the round for having got close to the answer: if I say "Adam Simpson" which reminds someone else that the answer is "Adam Sampson", then I get half a point and they get the full point, since my answer was edit distance N away from the correct one.

Be smart about which letters to uncover when revealing clues; if it clues "---- -------", I say "Bill Sampson", then "clue" again, then it should spot that I got the "Sampson" part right and weight heavily towards uncovering the first word.

Behave correctly when the answer is a command-word: if the answer is "clue" and I say "clue", then take that as a correct answer rather than giving me a clue.

Remove suffixes from nicks; MrTea|SW12 and MrTea are the same person.

Maintain a long-term high score table.

Maintain more statistics about each player: average time to answer, average number of guesses, quickest answer (weighted by length), average number of typos.

Support specialist rounds (subsets of questions). Given enough data, we could even do University Challenge mode.

For acronym questions, include the acronym letters by default in the clue ("What does USA stand for?" "clue" "U----- S-----...").

Keep track of the last thousand or so questions asked, so it knows not to ask them again.

Have a command to report problems with questions (and don't ask a question with an outstanding report).

Do something appropriate when the question is "how many ounces is X", the answer is "six ounces", and someone says "six". Build a list of ignorable units from the questions database?

Don't give away the entire answer on the first clue. (This happens most of the time for short answers at the moment.)

Allow handicaps for beginning players.

Give percentage scores based on how long people have been playing (above some minimum time), so you don't have to play a whole round to see how well you're doing.