lynx-chess / Lynx

Chess Engine, written in C#
https://lichess.org/@/Lynx_BOT
MIT License
47 stars 4 forks source link

new mobility values #216

Closed tissatussa closed 12 months ago

tissatussa commented 1 year ago

hi, i follow the developments of your Lynx engine, although i'm on Linux and compiling and using .NET code is a bit difficult - but i manage .. lately i see several PRs concerning new mobility values and i'm curious : how are you tuning these parameters ? (Only) by self play ? Do you also use test positions / .epd suits ? I remember an engine like Rodent IV has personalities and their parameters can be adjusted by the user .. are you performing tuning like that ?

eduherminio commented 1 year ago

Hi @tissatussa,

Thanks for keep following Lynx development and raising your questions.

Right now I'm focused on implementing new evaluation features: adding configurable parameters such as mobility values, bonus for open/semi-open columns, etc. The idea is that this should provide immediate strength gain, apart from the potential future one it enables. I'm also emphasizing tests while doing that, as I've been doing during the whole Lynx development, to avoid regressions and facilitate refactoring later. For now I'm using sample values taken from Bitboard CHESS ENGINE in C.

I'm briefly testing these changes with gauntlets of a few games against other opponents, rather than with self-play, to validate the actual gain exists. You can see sample results in #210 or #213 description. I'm aware such amount of games is not significative, but I guess it's better than nothing.

Tuning these values will come later at some point, I'm not familiar with tuning strategies yet, so I'm happy to read more about that how to use/implement "test positions / .epd suits" approach. I'm only aware of OpenBench framework, but haven't gotten into that world yet.

I'd still like to implement some features such as transposition table or endgame tablebases support before focusing on tuning per-se, but hopefully everything will come 😃

tissatussa commented 1 year ago

@eduherminio great! i will respond soon, in detail and with some other questions.

i'm on Linux .. can you say a few words about using .NET instead of eg. C(++) ? Was it a choice or you're just familiar with .NET ? I read Java is not the way to go when creating a (fast) engine.

tissatussa commented 1 year ago

..against other opponents, rather than with self-play..

nice! i always wondered if "tuning by self play" is a good idea anyhow .. once i read someone else stating such also.

..how to use/implement "test positions / .epd suits" approach..

i worked a bit with .epd test suites, and i wrote a nifty terminal script for it, first try however .. it only works properly in the great 'Konsole' terminal of KDE, using full colors and real time statistics by animation .. it's not on GitHub or so, just testing, but take a look at this post : https://github.com/algerbrex/blunder/issues/13 it has a screencast video of it - with music.

in short : those .epd test suites are FEN lists with a special format : also some (multi) 'bm' -Best Move(s)- and sometimes 'am' -Avoid Move(s)- are defined, both with a value when the engine 'finds' the bm or rejects the am .. this way obvious (?!) tactics / strategies can be defined and evaluated, using a (very fast) time control.

I have clue how to use test suites for tuning an engine though .. OpenBench i saw, but never worked with it.

..implement some features such -..- endgame tablebases support..

you might be interested in connection to an online TB .. once i discovered this feature when reviewing Weiss, see https://github.com/TerjeKir/weiss/ .. it has 'OnlineSyzygy' and even 'NoobBook, these are rather easy to implement according to the author of Weiss .. such online TB is not ideal, but it can be a start .. Weiss has UCI options for these. He only was struggling with the connection pinging / keep-alive / timing / something like that .. give it a try.

tissatussa commented 1 year ago

btw. the video is a bad example, i should make a new screencast of that terminal tool .. that video was typical for Blunder :-) When MPV is ON, many lines are displayed and change their MPV top-(5) constantly.

eduherminio commented 1 year ago

Regarding the language choice, it's just what I've been working lately with and I like it.

C# within .NET ecosystem, as a managed language, is I guess safer, by default, than C or C++; but that also makes it slower unless carefully used.

One of the fun parts this project is bringing me is investigating that advanced, low level usage that is indeed possible with this stack as well.

It's not that I expect my very first engine to ever compete with Stockfish anyway 😂

eduherminio commented 1 year ago

I definitely need to have a proper look at examples and those tests/links you mention and are pointing me at (thanks a lot!), but I'm afraid I'm short of time right now.

I'm however pleased to read that the approach is kinda similar to something I'm using in some of my existing tests (note allowedUCIMoveString and excludedUCIMoveString parameters in most tests under https://github.com/lynx-chess/Lynx/tree/main/tests/Lynx.Test/BestMove.

Of course tuning it's not a matter of pass/not pass, but... I'll figure it out!

eduherminio commented 1 year ago

Regarding online TB, I also had them in the TODO list to have it as a configurable option as well. It might be useful at least for my instance of the bot in lichess, although I don't know if people would use it locally to do 'proper' test engines.

tissatussa commented 1 year ago

concerning an online opening book, the chess engine ShashChess (see https://github.com/amchess/ShashChess/ ) also can connect to it :

Shashchess_Live_Book

this Chinese (!) URL http://www.chessdb.cn/cdb.php is also used by Weiss, not sure though.

eduherminio commented 12 months ago

Following up regarding few topics before closing the issue

how are you tuning these parameters ? (Only) by self play ? Do you also use test positions / .epd suits ?

Eval parameters are tuned now using lynx-chess/texel-tuner, a fork of GediminasMasaitis/texel-tuner

you might be interested in connection to an online TB

Online TB search at root position has been added as an option (OnlineTablebaseInRootPositions in uci), and I'd say it works okish, although I haven't extensively tested it. I've been unable to make it work during search though, due to too many requests to the online TB server

concerning an online opening book

Adding an opening book, online or not, is not something I'm planning to do. And given the amount of things I do have planned, don't count on it any time soon or at all 😅 It's easy to configure lichess bots to use one, so might eventually do that for Lynx_BOT, but no engine work is required for that