mblazev's blog

By mblazev, history, 7 weeks ago, In English,

I would like to present to you an open-source competitive programming (primarily codeforces) discord bot written in python by meooow, algmyr, Narut, Rahul, pajenegod, aryaman, keima915, chilli, c1729, cfalas and mblazev. Source code is avaliable on github. If you would like to try the bot without having to set it up yourself, enter this server: discord.gg/2CJ6qvY. The bot is still work in progress, but it is already 4 months old so it can already do quite a few cool things. Here is a showcase of a subset of its features:

  • It can plot rating distribution of either active or all codeforces users, in either normal or log scale, who have competed at least n times. For example, ;plot cfdistrib normal active 5 gives:
Click to reveal
  • It can also place a provided list of users on a plot of the percentile distribution of codeforces. For example, ;plot centile mblazev laggy heon +zoom
Click to reveal
  • If you're curious how the entire percentile distribution looks like ;plot centile
Click to reveal
  • It can plot codeforces rating graphs for multiple users. For example, ;plot rating mblazev heon tomx +zoom
Click to reveal
  • It can plot a histogram of problems solved by a user, color-coded by submission type. For example, ;plot solved stefdasca
Click to reveal
  • Of course, it works for multiple users as well. For example ;plot solved stefdasca pikmike
Click to reveal
  • It can even plot codeforces rating overlaid on a scatter plot of problems solved along with a running average of ratings of problems solved in practice! For example ;plot scatter pikmike
Click to reveal
  • And of course, it can also plot the rating distribution of server members. ;plot distrib
Click to reveal

3 other plotting commands are still WIP so I will not showcase them yet. Some non-graph features include:

Contest forecast
Smart mashup creator
Smart virtual contest picker
Smart practice problem selector
Ranklist with rating prediction
Contest reminders to subscribed users
It's easy to control the subscription
User stalking
Even displaying cf handle of given discord user looks beautiful!
It updates roles quickly!
Emoji-interactive list of server members
Scoreboard for fastest/shortest CSES solutions
3 stars -> starboard

It also has a set of commands which we refer to as "gitgud". They are ;gitgud, ;gotgud, ;nogud, ;gudgitters and ;upsolve. They incentivize solving problems around user's rating by giving points (depending on relative difficulty) and maintaining a scoreboard. In this example, a 1900 rated user requested a 100 rating higher problem (worth 12 points):

Click to reveal

To report a solved problem, you run ;gotgud.

Click to reveal

To skip a problem (after at least 3 hours), you run ;nogud.

Click to reveal

Apart from random problems, you can also gain points for ;upsolve-ing problems you failed in a contest. For example:

Click to reveal

To display the scoreboard, run ;gudgitters

Click to reveal

It has even more features (many of which are WIP), but I've omitted them for sake of brevity. We are also planning new features and we welcome new contributors; we'd be happy to help you find your way around the codebase. It's moderately big (3.2k lines of code, not counting comments and whitespaces) but stringent code review ensures the code remains non-terrible.

If you've come this far, just enter discord.gg/2CJ6qvY and try it out! Make sure to read ;help for more details.

 
 
 
 
  • Vote: I like it
  • +225
  • Vote: I do not like it

»
7 weeks ago, # |
Rev. 5   Vote: I like it +39 Vote: I do not like it

Nice

»
7 weeks ago, # |
  Vote: I like it +29 Vote: I do not like it

great bot :D

»
7 weeks ago, # |
  Vote: I like it +26 Vote: I do not like it

Wow the bot looks amazing! Can't wait to try it out :)

»
7 weeks ago, # |
  Vote: I like it +42 Vote: I do not like it

I joined the server and the people there are really friendly. The bot's features are also very useful too.

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it +11 Vote: I do not like it

    horse being horse

    • »
      »
      »
      7 weeks ago, # ^ |
        Vote: I like it +2 Vote: I do not like it

      It's sad that horse has to be like that.

      • »
        »
        »
        »
        7 weeks ago, # ^ |
          Vote: I like it +2 Vote: I do not like it

        Yeah, that horse is acting like a piece of crap. Other people there are friendly.

        • »
          »
          »
          »
          »
          7 weeks ago, # ^ |
            Vote: I like it +20 Vote: I do not like it

          Horse being the savage he is is one of the first reasons we still did not die. He is doing a great work.

          • »
            »
            »
            »
            »
            »
            7 weeks ago, # ^ |
              Vote: I like it -10 Vote: I do not like it

            Yeah no doubt abt that! He is really good at what he does clearly but he's being arrogant and I think he knows that. Well, people there have told him that and he's taken that into account. Anyway, this bot is fun and really useful!

          • »
            »
            »
            »
            »
            »
            7 weeks ago, # ^ |
            Rev. 2   Vote: I like it +3 Vote: I do not like it

            Indeed, where would we be without Horse's divine providence? /s

»
7 weeks ago, # |
  Vote: I like it +23 Vote: I do not like it

Good Stuff

»
7 weeks ago, # |
  Vote: I like it +19 Vote: I do not like it

Have you considered implementing something similar to CF Predictor or perhaps even borrowing some of the public CF Predictor API to enhance the bot?

I would be very interested in working on what could be the greatest CF crossover to date. :)

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it +14 Vote: I do not like it

    The bot does rating prediction. Read the whole post :P

    • »
      »
      »
      7 weeks ago, # ^ |
        Vote: I like it +14 Vote: I do not like it

      Sorry, I should have been more specific! I meant that it would be nice to see what your rating change would have been during a virtual participation as well, in addition to the live participations currently supported.

      • »
        »
        »
        »
        7 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Oh you can pitch that idea to #suggestions and it will be put on list. Though there are currently 32 issues and 6 pull requests outstanding so you might have to wait a while.

»
7 weeks ago, # |
  Vote: I like it +33 Vote: I do not like it

Bot is amazing, great work :D

»
7 weeks ago, # |
  Vote: I like it +32 Vote: I do not like it

the best thing to happen to codeforces since the invention of codeforces

»
7 weeks ago, # |
  Vote: I like it +8 Vote: I do not like it

i think you have forgotten to put kkbb in the credits list, mblazev

»
7 weeks ago, # |
  Vote: I like it +19 Vote: I do not like it

I wish I could've contributed to this amazing bot!

»
7 weeks ago, # |
  Vote: I like it -8 Vote: I do not like it

Smart mashup creator, VC picker, etc. Can you explain what makes them smart?

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it +38 Vote: I do not like it

    They give you problems/contests which

    • you haven't solved
    • aren't nonstandard (e.g. april fools)
    • you aren't credited as writer on contest page [we scrape cuz no api :(]
    • are relatively recent (randomization is biased)
    • are rating-appropriate

    Though you can customize through options.

    • »
      »
      »
      7 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Oh, can we choose mashup contest problems with specific problem tags?

      • »
        »
        »
        »
        7 weeks ago, # ^ |
          Vote: I like it +11 Vote: I do not like it

        I actually haven't thought of that. There is code for that in ;gimme command (see post for example) but I can easily make ;mashup do the same thing.

»
7 weeks ago, # |
Rev. 2   Vote: I like it +22 Vote: I do not like it

rip link isnt working
upd: working now

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

great work!! thanks a lot!!

»
7 weeks ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

why Codeforces handle for @handle not found in database shows for green even i set my handle cp community discord ?? is it a bug ? UPD : got that.

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Thanks for crediting my two commits

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    Well remember if you didn't write that I would have done a polyfit() in ;chilli lmao

»
7 weeks ago, # |
  Vote: I like it -25 Vote: I do not like it

You win this round. I'll use TLE for CPC

Spoiler
»
7 weeks ago, # |
Rev. 2   Vote: I like it +9 Vote: I do not like it

Good bot!

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I'm pretty sure this bot will help CP become more fun as a sport.

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

why discord link is not working?