lichess-bot-devs / lichess-bot

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

Why not use weighted_choice instead of random choice in get_book_move? #84

Closed lichapibot closed 6 years ago

lichapibot commented 6 years ago

Python chess has weighted choice in its polyglot module:

https://github.com/niklasf/python-chess/blob/master/chess/polyglot.py#L460

Why not use this instead of simple random choice in get_book_move:

https://github.com/careless25/lichess-bot/blob/master/main.py#L178

tttony commented 6 years ago

I was planning to add an option like random_weight: true, because reader.choice(board, weight).move() also has an option to add specific weight

What do you think?

lichapibot commented 6 years ago

I think instead of boolean flags, it would be better to have a verbal selection method name:

book_move_selection: "uniform random"

book_move_selection: "weighted random"

book_move_selection: "best move"

ddugovic commented 6 years ago

IMHO "weighted" (weighted random) should be the default value.

tttony commented 6 years ago

Test from here: https://github.com/tttony/lichess-bot/tree/randomw