Code52/jibbr — pull request #41 by ssboisen (2012-01-13 23:14:11+00:00)
Title: Quiz bot (Issue #16)

I started implementing the quiz bot.

For now it only does some celebrity and movie related questions which are hardcoded. I'm planning on adding support for an API like True Knowledge or other later down the line. Bot for now people can add additional questions and question-categories.

I havde included some unit tests which covers most of the code but I bothered verifying everything. Since the bot couldn't be mocked without an interface I had to introduce an IBot interface. So I had to refactor a bit of the base jabbot code.

As a poor mans spelling-compensater I use the longest common substring between the guess and the correct answer and accept the answer if that substring is longer than 60% of the size of the correct answer. This can be tweeked using a Property in the QuizSprocket class.

The bot accepts a couple of different commands like score and top10 which will display the scores of the players. Also, as long a the latest asked question havn't been answered and one minute have not passed you can't request another question.