vrijdag, december 28, 2007

 

Automatic adjustment of difficulty (by Otto)

I've implemented an automatic adjustment of the difficulty level of questions. As you know, the difficulty level is indicated by 1, 2 or 3 gray dots, and depending on the level you can win or loose 1, 2 or 3 points when you solve the questions. The level is set by the author in the Author Zone (properties tab).

But once a question has at least 10 views, the level gets updated automatically once a day by Otto, the new automatic agent of the site. The rules are:
- If more than 66% of people know the answer, the level is 1 (easy)
- If between 33% and 66% of people know the answer, the level is 2 (moderate)
- If less than 33% of people know the answer, the level is 3 (difficult)

Otto (the automatic agent of the site) is implemented in ASP.NET. I looked hard to find an asp.net task scheduler, but couldn't find one. Many implementations use a console application that calls a web service, or use the Windows Task Scheduler. I don't have access to either on my hosted environment at seekdotnet.com. If you do control your own server, those solutions might work for you:
http://www.codeproject.com/KB/aspnet/ASPNETService.aspx
http://www.codeproject.com/KB/vb/WebJobScheduler.aspx

I don't need fancy schedulers that run if the application is down or idle, so I just added some code in the global.asax file in the Session_End section. That way every time a session is ended, the code runs and checks the database if a job should run. It works.

While I was at it, I also made Otto send messages when your questions reach 10 or 100 views, or when someone adds you as a contact. Otto only speaks English, and I hope that is not a problem.

Labels: , , ,