You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+49-7Lines changed: 49 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,26 +1,31 @@
1
-
Environment Setup (Python 3.10+ Recommended)
1
+
## Environment setup (Python 3.10+ recommended)
2
2
- Clone repo
3
3
- Open VSCode and go to the program folder
4
4
- Create a venv `python -m venv .venv`
5
5
- Enter the venv `.\.venv\Scripts\activate`
6
6
- Run `pip install -r requirements.txt`
7
7
8
-
Lichess Connection:
8
+
## Lichess connection
9
9
- Create an account on [Lichess.org](https://lichess.org/signup?referrer=https%3A%2F%2Flichess.org%2F)
10
10
- Hover over your name in top right, then select `Preferences`->`API access tokens`->`Click the blue button top right to create a token, give your token a name (ex: lichess-bot-token), select all the permissions then click Create.
11
11
- Save this token to the config.yml under the token key. **Note to set all the option values of the bot to Green to ensure maximum compatibility. Remember to save your token and do NOT share it or hardcode it in your code.**
You can run a quick smoke test in a sample python file as in:
19
17
20
18
From the command line:
21
-
```export lichess_token="YOUR_TOKEN"``` (in linux/max osx)
22
19
23
-
```set lichess_token="YOUR_TOKEN"``` (in Windows)
20
+
```bash
21
+
export lichess_token="YOUR_TOKEN"
22
+
```
23
+
(in Linux/macOS)
24
+
25
+
```powershell
26
+
set lichess_token="YOUR_TOKEN"
27
+
```
28
+
(in Windows)
24
29
25
30
In a test_token.py file run:
26
31
```
@@ -40,8 +45,45 @@ def smoke_test_token():
40
45
smoke_test_token()
41
46
```
42
47
43
-
Afterwards see the homemady.py file for sample chess engine classes, for which you will subclass your own, namely from the MinimalEngine class from the LichessBot/lib/engine_wrapper.py file.
48
+
## Upgrade to bot account
49
+
After entering your token in the config.yml file, you can run the following command to upgrade your account to a bot account:
50
+
```bash
51
+
python lichess_bot.py -u
52
+
```
53
+
54
+
If successful, this command will also start running your bot on lichess. Navigate to lichess.org. You should see a robot icon at the top left corner indicating that you are logged in as a bot. Press play against computer and run your bot in a test game, ensuring it is able to make moves. Your starting bot is a random move bot, so don't expect it to play well!
55
+
56
+
## Customize your bot
57
+
Afterwards see the homemade.py file for sample chess engine classes. A template class called MyBot is provided for you to customize your own bot logic. Expand on the search method to implement your own chess engine logic. You may add any functions you need to the class.
58
+
59
+
The only file you should change is homemade.py. The other files are driver code that connects to lichess and handles all the API calls. The homemade.py file contains the bot class that you can customize.
60
+
61
+
## Run your bot for testing
62
+
To run your bot, simply execute the following command:
63
+
```bash
64
+
python lichess_bot.py
65
+
```
66
+
67
+
Or
68
+
69
+
```bash
70
+
python lichess_bot.py -v
71
+
```
72
+
73
+
If you want to see verbose logging output.
74
+
75
+
## Running your bot during the tournament
76
+
77
+
During tournament time we will be using the lichess GUI to send match challenges.
78
+
79
+
## Algorithms You Should Check Out
80
+
### Minimax Search
81
+
### Alpha-Beta Pruning
82
+
### Iterative Deepening
83
+
### Transposition Tables
44
84
85
+
## Recommended watching
86
+
- Great video on chess engine development that covers some of the above algorithms in detail: https://www.youtube.com/watch?v=U4ogK0MIzqk&t=1008s (Note you can skip the parts that cover board representation and move generation since those are already implemented for you in this starter code).
45
87
46
88
## Citation
47
89
If this software has been used for research purposes, please cite it using the "Cite this repository" menu on the right sidebar. For more information, check the [CITATION file](https://github.com/lichess-bot-devs/lichess-bot/blob/master/CITATION.cff).
Copy file name to clipboardExpand all lines: config.yml.default
+3-6Lines changed: 3 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ url: "https://lichess.org/" # Lichess base URL.
3
3
4
4
engine: # Engine settings.
5
5
dir: "./engines/" # Directory containing the engine. This can be an absolute path or one relative to lichess-bot/.
6
-
name: "engine_name" # Binary name of the engine to use.
6
+
name: "MyBot" # Binary name of the engine to use.
7
7
# interpreter: "java"
8
8
# interpreter_options:
9
9
# - "-jar"
@@ -40,11 +40,11 @@ engine: # Engine settings.
40
40
offer_draw_pieces: 10 # Only if the pieces on board are less than or equal to this value, the bot offers/accepts draw.
41
41
42
42
online_moves:
43
-
max_out_of_book_moves: 10 # Stop using online opening books after they don't have a move for 'max_out_of_book_moves' positions. Doesn't apply to the online endgame tablebases.
43
+
max_out_of_book_moves: 4 # Stop using online opening books after they don't have a move for 'max_out_of_book_moves' positions. Doesn't apply to the online endgame tablebases.
44
44
max_retries: 2 # The maximum amount of retries when getting an online move.
45
45
# max_depth: 10 # How many moves from the start to take from online books. Default is no limit.
46
46
chessdb_book:
47
-
enabled: false # Whether or not to use chessdb book.
47
+
enabled: true # Whether or not to use chessdb book.
48
48
min_time: 20 # Minimum time (in seconds) to use chessdb book.
49
49
max_time: 10800 # Maximum starting game time (in seconds) to use chessdb book.
50
50
move_quality: "good" # One of "all", "good", "best".
0 commit comments