rawsonj / triviabot

A simple IRC trivia bot written in python using twisted.
GNU General Public License v3.0
41 stars 51 forks source link

Limit the number of standings so we don't wait 10 minutes for them to be printed out. #47

Open rawsonj opened 8 years ago

rawsonj commented 8 years ago

Due to #46 being resolved, users can now see the standings the bot is keeping track of.

The issue here is that maybe we've recorded a few hundred users playing the game, and if the rate-limiting is set to a large-ish number (say 1 second) we may wait for several minutes as the standings are queued instantly in the bot but sent to the server at the configured rate.

Several trivia questions can then be queued up and go by while the standings are still being printed out.

This can be fixed in one of two ways:

1: Limit the standings to the top ten, or maybe just the ten people around where the user is, or some variation on this. This would put an upper bound on the time required to print out the standings.

Pros:

Cons:

2: Implement a priority queue or multiple queues. This may be preferable because if a user wants to see the complete standings they don't care about getting them as fast as possible, but the game should keep running as normal and be just as responsive as it normally would be.

Pros:

Cons:

andy5995 commented 8 years ago

What about a compromise? Show the top 10 or 20.

When a user gets a question correct, his rank is shown (or he can use ?rank at anytime).

If it's still very important that people can see the whole list, have an option that will display a URL to where the rankings are posted. Admins can turn the option on or off, depending on if they want to post rankings to a forum, web site, wiki, etc.

rawsonj commented 3 years ago

I think I'll show the top 5, then skip a bunch, and then show the position the user is in and the surrounding nicks.

Kind of like:

  1. bob
  2. charlie
  3. fred
  4. fred2
  5. fred3

...

  1. guy_before_user2
  2. guy_before_user1
  3. user
  4. guy_after_user1
  5. guy_after_user2

...