lichess.org
Donate

How to make a Lichess BOT

Chess botChess engine
The step by step guide

HOW TO MAKE A LICHESS BOT

  1. Install “Phyton”: https://www.python.org/downloads/
  2. Check whether your computer is 32-bit or 64-bit (so that you know whether to download & install “Notepad++” and “7-Zip” in 32-bit or 64-bit and whether to use stockfish x32 or stockfish x64 versions...).
  3. Install “Notepad++” (32-bit or 64-bit, depending on your computer): https://notepad-plus-plus.org/downloa...
  4. Install 7-Zip (32-bit or 64-bit, depending on your computer): https://www.7-zip.org/
  5. Go to https://github.com/ShailChoksi/liches... - Click on “Code” and then click “Download ZIP” - Extract that file with “7-Zip” and put that extracted folder on your Desktop (and rename it if you want )
  6. Download “Stockfish” from here: https://stockfishchess.org/
  7. Put stockfish engine into “engines” folder and rename it to “stockfish”. - If your computer is 32-bit, then use stockfish 32bit - There are 3 versions of x64 stockfish engines (x64, modern, bmi2): - bmi2 is the strongest, modern is little bit weaker, x64 is weakest. - How do you know which one you should use? Well, if your computer is i3, i5, i7 or i9 then use bmi2. If your computer is weaker then that, then try using modern or x64 version. - How do you know whether your computer is i3, i5, i7, i9 or weaker? I showed you in my video ;)
  8. Create new account on Lichess (this will be your BOT ACCOUNT, and you can NOT play any games on that account, otherwise you won’t be able to create your BOT!) - Here’s a link for registration: https://lichess.org/signup
  9. Once you created new account, you’ll receive an E-mail to Verify your account, so go verify your account! - After that, go here: https://lichess.org/account/oauth/token - Write “Bot token” + Check all boxes
  10. Copy your “token number” and paste it into “config.yml.default file”
  11. Set everything you want in your config.yml.default file (engines name, time controls to play/not play, etc.) 12) Save as “config.yml” (remove ‘default’)
  12. Open CMD (Command Prompt) + Copy-paste all these commands below (one by one). - In order to paste the command into CMD , you need to press Ctrl + V on your keyboard and then you press Enter on your keyboard. - These are the commands: python --version python –m pip install virtualenv python –m pip install --upgrade pip Now watch what I do in video and create this command like I do virtualenv .\.venv -p python .\.venv\Scripts\activate pip install –r requirements.txt python lichess-bot.py –u
  13. Whenever you want to play with your BOT, you need to open CMD and copy-paste these 3 commands (all at once, or one by one, doesn’t matter) and then you press Enter on your keyboard: cd C:\Users\Dange\Desktop\Tarzan4Ever\lichess-bot-master .\.venv\Scripts\activate python lichess-bot.py –u -

If you want to make your BOT faster, slower, stronger or weaker then you need to change some settings in config.yml file - Open stockfish.exe, type 'isready', then type 'uci', and now you'll see all commands that your stockfish can use in your config.yml file and you can see explanation for what's the default, minimum or maximum number for each command!

  1. Threads
  2. Move overhead
  3. Slow mover
  4. Ponder
  5. MultiPV
  6. Skill Level
  7. Minimum Thinking Time ***If you want your stockfish to play best moves, then you don't need to add MultiPV, Skill Level and Minimum Thinking Time commands in your config.yml file. Why? Because these commands are already (by default) set up for best play, so you don't need to add them addionally in your config.yml. - In other words, add MultiPV, Skill Level & Minimim Thinking Time in your config.yml, ONLY if you want to weaken your BOT. Then try experimenting with those commands untill your BOT plays very weak...*** - When you open your config.yml, you can choose which time controls you want (or don't want) your BOT to play. You can choose ultrabullet, bullet, blitz, rapid, classical & correspondence: - Put ''#'' for time controls you DON'T want your BOT to play. For example, if you put ''#'' for classical, it means your BOT WON'T play classical games! - The same thing applies for ''modes'' in your config.yml. You can choose casual or rated modes. For example if you put ''#'' for rated, it means your BOT won't play rated games. If you want your BOT to use an OPENING BOOK, go on Internet, find some .bin book (only .bin book, you can't use any other format, such as .ctg and others). - Once you downloaded book, put it in 'engines' folder and then set it up in config.yml just like I did in my video... - Set min_weight to ''1'', max. weight to ''100'' and selection to „best_move“ - I don't know what min_weight set to ''1'' means (I just know that's best configuration). - max. weight set to '100' means your BOT will play 100 moves from your book (if possible). - selection set to ''best_move'' means your BOT will always play best move from your opening book.

I hope you like it!