Simple chess cheat for lichess based on opencv.
Highlight above the board the best next move for you.
The program will wait for the opponent turn depend on the clients chosen color.
Then it will loop through every cell to detect the last moveset and feed the stockfish engine.
Which will predict the best next move for the client.
The clients moves are gathered by detecting the
position where the client clicked on the board. And then translated to a moveset.
In the old method we captured every 501 milliseconds the board to detect the last moveset.
That brought up a big problem because if the opponent moved too fast we would miss
the clients move. Using this method you can even play bullet mode.
Use pip install -r requirements.txt to install all dependencies.
- Download the main.py and the data folder
- Download stockfish from here: https://stockfishchess.org/download/ I'v used "64-bit: Maximally compatible but slow."
Keep in mind the exe file needs to be at same drive as the scripts running on.
Also you might need to change the file name in code! Not just the path. - You need to extract the exe file you downloaded and in main.py code, change the path to your stockfish engine exe file.
- About the stockfish.set_depth(16) you can put higher values. The higher the value the more accurate the prediction But it's also slower. Using set depth 16 I tied against stockfish level 8 so it's preety strong as it is.
-
- Open up a game while logged in to lichess (Playing as anonymous will change the board size and mess everything
Also it's only tested on chrome and on 100% zoom while logged in). - During the freeze time open up the program choose your starting color. And alt+tab back to the browser (Don't use your mouse).
Keep in mind that your mouse clicks from that moment matters.
So play like that: 1 click represent the from cell and 1 click represent the to cell when it's your turn.
No dragging pieces.
No checking youtube for a second
It will mess everything and the program will crash
- Open up a game while logged in to lichess (Playing as anonymous will change the board size and mess everything
Keep in mind lichess would most definetly ban you for playing against other players.
Play only against bots!
- The program only tested with Chrome on resolution 1920x1080 and the zoom needs to be 100%
- Technically you can make the program to work with any kind of browser on any kind of zoom. As long as you fix the cordinates of the board screenshot and the cell size.
- The program is more stable now but need to get a better check on mouse clicks.
In order to avoid missread client moves. 3 conditions needs to be checked to make it perfect:- Check if board is visible.
- Check if mouse clicked within board rectangle.
- Check if move is legal as in between a1 - h8.
- Adding support for black pieces
- Saving games played
- Auto Play (Added check it out through the config. Only works for white player and still have some bugs.)
- Loading game movesets from File.
- Drawing live on the board to highlight best next move.
- More stable clients moves read.
- Currently the program reads last move using pixel matching.
It works but if we miss one move the predictions are wothless.
I'm going to develop an improved version of this cheat. That will detect
pieces live from the screen. Then translate the board to Forsyth–Edwards
Notation to get prediction from current board position. This will allow to solve
puzzels and start the cheat mid-game.
This entire project done for the purpose of challenge and education.
Not for the purpose of cheating
Developed on Python 3.7.7