lichess-bot-devs / lichess-bot

A bridge between Lichess bots and chess engines
GNU Affero General Public License v3.0
760 stars 443 forks source link

Engine only plays first move from book #248

Closed SamReeves closed 2 years ago

SamReeves commented 3 years ago

I'm pretty certain this is not a bug... just an example of correct evaluation.

I want my bot to play some pretty bad openings and then "start playing chess". However, it only selects the first move from the book, ie. d2d4 or e2e4. Then it starts to play moves given from the evaluation. Am I missing something? Should I make a book with false valuations in it to trick into thinking that these bad variations are actually viable?

Thanks in advance!

ghost commented 3 years ago

Does the bot book only have the first move, or somehow you created the book incorrectly?

oivas000 commented 3 years ago

what is your "min_weight"? try reducing that use some big books this link sometimes help you https://www.chess2u.com/f4-computer-chess-opening-books

MarkZH commented 2 years ago

@SamReeves Do you still need help with this issue?

SamReeves commented 2 years ago

I stopped trying to figure this out ages ago... But, I could definitely go back to it.

MarkZH commented 2 years ago

After doing some reading, it looks like what you want to do is create a polyglot section in your bot's config.yml with the following configurations:

polyglot:
  enabled: true
  book:
    # list books here
  min_weight: 0 # choose from all legal moves
  selection: "uniform_random" # choose a move with equal probability, regardless of quality
  max_depth: 2 # or however many bad moves to make before starting to play for real

This will essentially pick a random legal move from the first few positions in the game. These will probably be bad moves since moving randomly is rarely a good strategy. If you only want to pick bad moves, you'll either have to create your own polyglot books with good moves getting low weights, or write a polyglot parser into your bot that chooses low weight moves. Here's a link to the polyglot book format, in case it might be useful.

SamReeves commented 2 years ago

Thank you @MarkZH !