How to beat your friend at chess that always wins:
A python script that automates games on Lichess against your opponents with selenium and pyautogui. There are several flexible parameters including engine source, time control, move speed, account type, and more... ✨
git clone https://github.com/danialasaria/LichessAI.git
cd LichessAIpython3 -m venv venv
source venv/bin/activatepip3 install -r requirements.txtFind the chromedriver that matches your computer and visit the corresponding link to download. ChromeDriver works as a bridge between Selenium and Chrome enabling automated control of the browser.
https://googlechromelabs.github.io/chrome-for-testing/python3 app.py
Press Control + C
Set to Dragon Chess Engine by Komodo but can be replaced with the path to the binary of any engine that follows UCI (Universal Chess Interface) protocol.
EX: Stockfish
brew install stockfish
#find_executable is a function that returns the path to input's executable
ENGINE_PATH = find_executable('stockfish')
Set to create a challenge of 3 minutes and 0 second increment but can be changed to any time control in Lichess's Quick Pairing.
TIME_CONTROL = '3+0'
Set to 0.1 seconds, but can be changed to any duration.
ENGINE_ANALYSIS_TIME = .1
Set to anonymous mode, but if ANONYMOUS_MODE is changed to false and username/password filled in, you will be logged in and games will be played on your accounts behalf.
IMPORTANT NOTE: I don't condone cheating and this is purely for experimental purposes.
ANONYMOUS_MODE = True
LICHESS_USERNAME = ''
LICHESS_PASSWORD = ''
Feel free to open a PR if you see anything to improve on!
If the cursor is too high/low it is likely you need to adjust the below pixel amount to correspond to your chromium window.
DISTANCE_BETWEEN_TOP_OF_SCREEN_AND_LICHESS = 184
AGPL v3 © Danial Asaria
If you found this project interesting, please consider sponsoring me or following me on twitter
