lichess.org

How to make a BOT?

Hey guys, I am wondering how to make a bot today. Could anyone give me steps to make a bot account?

You were wondering that yesterday also. But the question remains, why would you want to? You clearly don't know computers or you could use the forum search to find the 500 other people who have asked that same question and had it answered. And BOTS are for computer people to run their engines.

MAKING A LICHESS BOT

Methods:
Let's keep it simple, these are the good methods to make a strong and good programmed bot in lichess
Step 1: Learn the difference between an engine and a bot. The difference between an engine and a bot is that, the engine is the machine which thinks and the bot is the machine which communicates between our engine and lichess.
Step 2: Create an excel spreadsheet which consists of the requirements of your bot (not engine).. The requirements can be like when your bot should be online, which challenges your bot should accept etc.
Step 3: Plan how to execute those requirements and learn them. For example: We have to add codes to make the bot keep online etc.
Step 4: Create an excel spreadsheet which consists of the requirements of your engine (not bot)..
Step 5: Learn what is an chess engine and how it works by using google
Step 6: Start coding your engine (before that learn how a engine works)
Note: I first prefer that you make a bot through herokuapp, then you make a bot by copying and pasting stockfish (or some other engine), then start making your own engine..
Important link that you might need while doing the process:
github.com/ShailChoksi/lichess-bot --->Interface link
lczero.org/contribute/ ---> Link to contribute to lc0
lichess.org/api ---> Lichess API
python-chess.readthedocs.io/en/latest/---> Python chess module
github.com/LeelaChessZero/lc0 ---> Lc0 Bot Codes
lichess.org/blog/WvDNticAAMu_mHKP/welcome-lichess-bots ---> Lichess Blog Post of Bots
github.com/glinscott/leela-chess ---> Lc0 Bot Codes
github.com/LeelaChessZero/ ---> Full Lc0 projects and profile
lczero.org/ ---> Lc0 website
www.chessprogramming.org/Main_Page ---> Check this for more on chess programming
hypereasy.herokuapp.com/ ---> Herokuapp link
developers.google.com/edu/python/ ---> A free course on python offered by google

The following ways will also prove useful:
1st way: (The tougher way, but you can have your own brain) (This process might even take years)
To create a BOT, the first and foremost thing is that you should learn coding (I recommend you start with python or C). Then after you learn programming, you should develop the brain of your BOT in the language you wish. An example brain is Lc0, Stockfish etc. Then you have to interface your BOT's brain using the following links: github.com/ShailChoksi/lichess-bot and lichess.org/api. You will have to create a new account and then interface it with lichess. You can check this link to learn more about chess programming: www.chessprogramming.org/Main_Page. Remember that this process is long and you will need a lot of coding skills, but this will help you to make a powerful BOT like the Lc0 and Stockfish and you become a coding genius .You can even borrow some codes from other BOTS (If they are open source) For instance: Lc0's codes: github.com/glinscott/leela-chess (the codes are not given completely as someone can copy the codes)

2nd way: (The hyper easy or easy chess way) (This way is short and easy, but you won't get good coding skills and such skills, you can only get a BOT)
You have to first create an empty lichess account. Then you will have to go to this link: hypereasy.herokuapp.com/ and make your BOT. Making a BOT using the heroku app itself has many varieties. Check this:
- easychess.herokuapp.com/
- easychessreserve.herokuapp.com/
- hypereasy.herokaupp.com/
Just log in as a bot and as long as your browser is open on the site (any one of the above 3), your bot will run.
Strength: minimal, not too strong, but not too weak (1800-2000 lichess rating approx)
Engine: Stockfish (9, 9 and 12 respectively, if I’m right)

3rd way: docs.google.com/document/d/1q6n3vU6HU1hvz_jxnVVpgIg2tiElhGlDLdwBoJ5S4B0/edit ---> Check this. Full credits of this way of documentation goes to Pineapple bots.
1) Install “Python”: 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): notepad-plus-plus.org/downloa...
4) Install 7-Zip (32-bit or 64-bit, depending on your computer): www.7-zip.org/
5) Go to github.com/ShailChoksi/lichess-bot...
- 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 – I renamed mine into Tarzan 4Ever)
6) Download “Stockfish” from here: stockfishchess.org/
7) Put the stockfish engine into the “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 a 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 than that, then try using a 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 a 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: lichess.org/signup
9) Once you create a new account, you’ll receive an Email to Verify your account, so go verify your account!
- After that, go here: 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’)
13) 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

14) 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.
- In my case that looks like this (in your case, only the first command will be different):
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 than 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 an 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 additionally in your config.yml.
- In other words, add MultiPV, Skill Level & Minimum Thinking Time in your config.yml, ONLY if you want to weaken your BOT. Then try experimenting with those commands until 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 ultra bullet, 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 the Internet, find some .bin book (only .bin book, you can't use any other format, such as .ctg and others). (For example: drive.google.com/file/d/1UgsKYO7iVBijEaWSeVoy_tTfZLufPExZ/view)
- Once you downloaded the book, put it in the '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 the 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 the best move from your opening book.

Other links:
lichess.org/forum/off-topic-discussion/hyper-bot-new-ideas-for-bot-development?page=1#1
lichess.org/forum/team-lichess-bots/how-to-create-bot
docs.google.com/document/d/1q6n3vU6HU1hvz_jxnVVpgIg2tiElhGlDLdwBoJ5S4B0/edit?ts=6080bac7#heading=h.7u0fpl8lce36

1. Create a new lichess account and confirm it. Don't play any games on it, though.
2. lichess.org/api. Go to BOT, and then go to "Upgrade BOT account" (lichess.org/api#operation/botAccountUpgrade)
3. Create a personal API token
4. Check all boxes
5. Copy the code it gives you
6. Open CMD (Command Prompt)
7. Type this text into the Command Prompt: curl -d '' lichess.org/api/bot/account/upgrade -H "Authorization: Bearer YourTokenCodeHere"
8. Press enter. The text "YourTokenCodeHere" is where you should put your token code from the API access token.
9. View your profile. Your New Username should have a "BOT" in front.
This method could also be used

Reconnecting