lichess-bot-devs/lichess-bot

How could I get my engine to receive the Wtime and Btime of a lichess game?

vibranium21 opened this issue · 2 comments

I am improving my engine's time management, and I love to test my engine out on lichess. My engine is not uci. So I use the strategies.py to connect the bot to lichess. Is there a way to receive wtime and btime without making the engine Uci?

Your engine already gets the time but it is under *args which is why it isn't shown. If you remove *args you can use time_limit.

class MyEngine(ExampleEngine):
    def search(self, board: chess.Board, time_limit: chess.engine.Limit, ponder: bool, draw_offered: bool,
               root_moves: MOVE) -> chess.engine.PlayResult:
        wtime = time_limit.white_clock
        btime = time_limit.black_clock
        winc = time_limit.white_inc
        binc = time_limit.black_inc
        CODE HERE
        return PlayResult(engine_move, None)
MarkZH commented

@vibranium21 We've added another example homemade engine in strategies.py to demonstrate how to get the game clock and other information to your engine. Essentially, you change the arguments to the search method. Please reopen this issue if you have trouble with this in the future.