Torom / BotLi

Lichess Bot
GNU Affero General Public License v3.0
44 stars 82 forks source link

[enhancement] Add a delay before launching a challenge #16

Closed Unk0wnN0tBaad closed 2 years ago

Unk0wnN0tBaad commented 2 years ago

Hi Torom!

I propose an option called "ChallengeDelay" so that the BOT only launches a challenge after a moment of inactivity.

I noticed that when my BOT uses BotLi, it can do ~100 games so when adding a delay of even 1 minute or more, it can do double that.

The option is available on ShailChoksi / lichess-bot, and I think it could be a plus.

What do you think about it?

Sincerely, A BotLi user

Torom commented 2 years ago

Hi,

there is already a delay before a new challenge is started. So that others can challenge the bot. This delay is fixed to 10 seconds. It would be no problem to make this delay configurable.

However, this will not increase the number of games to 200 in one day. The rate limit is 200 challenges per day. Rejected challenges also count, so it varies how many games you can play per day.

Unk0wnN0tBaad commented 2 years ago

Yes, it would be nice to configure that delay.

So, if I understand correctly, my rate limit was here maybe because I play a lot of games in the past day and the rate limit only refreshes in 24 hours. If I play 200 games the day before, and I start for example at 5:00 PM and finish at 10:00 PM and the next day I start at 5:10 PM, my rate limit will be less than 200 games.

Because today I get the rate limit at 96 games and you are right because I restart my BOT maybe 2 hours later and it can play again.

Torom commented 2 years ago

Yes I am not quite sure when the 24 hours limit is reseted. But it works like this. Most of the time I can do about 140 games in one day.

Unk0wnN0tBaad commented 2 years ago

By the way, your "Move Overhead" management is great. On ShailChoksi / lichess-bot when you add Move Overhead Stockfish's performance plummets, and I lose all my games while with BotLi it works perfectly.

Torom commented 2 years ago

Thanks, it's not really perfect, but I'm quite happy with the way it works.

With d5e3327 you can set the delay in the config in the matchmaking section. Don't be surprised, this delay also applies when starting the matchmaking mode. So it takes the delay until the first challenge starts.

Feel free to test the change and if everything works you can close the issue.

Unk0wnN0tBaad commented 2 years ago

It works perfectly, but it is normal that when a challenge is declined, it waits for the delay that we put?

Wouldn't it be nice if when the challenge is declined he tries again right away?

Torom commented 2 years ago

Well, that wasn't a problem when the time was fixed to 10 seconds. :D

I understand the idea, but this would need more changes and I think a long delay is more something for long running applications and then it doesn't matter if the delay is waited twice. (Of course you can be unlucky and wait much longer).

Unk0wnN0tBaad commented 2 years ago

No worries it was just to know and I understand your idea too.

Thank you for taking the time to do all this.

Torom commented 2 years ago

Another thing to keep in mind is that the matchmaking timeout system is not designed for long pauses between games. So if you play short games (which only generate short timeouts) and then set a long delay. It can happen that you challenge the same or only a few different opponents in each challenge.

However, this is not a problem if we are talking about a delay of a minute or so. I rather think about long delays of 30 minutes or more.

Unk0wnN0tBaad commented 2 years ago

Is there really any point in adding so much delay? 30 minutes seems huge to me, whereas 1 or 5 minutes is already more reasonable and explainable.

Unk0wnN0tBaad commented 2 years ago

And it's normal to have few opponents when such a big delay is set because it seems to me that the BOT challenge to the white first and then to the black so if the matchmaking takes 30 minutes to start, the challenge starts and then another 30 minutes for the white game it's hellish :D