All Projects → karayaman → Play-online-chess-with-real-chess-board

karayaman / Play-online-chess-with-real-chess-board

Licence: GPL-3.0 license
Program that enables you to play online chess using real chess board.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Play-online-chess-with-real-chess-board

ChessLib
C# chess library containing a complete data structure and move generation.
Stars: ✭ 37 (-87.15%)
Mutual labels:  chess
littlewing
Chess engine written in Rust ♛
Stars: ✭ 27 (-90.62%)
Mutual labels:  chess
blitz-tactics
Fast-paced chess tactics trainer
Stars: ✭ 137 (-52.43%)
Mutual labels:  chess
Realtime-OpenCV-Chess
♔ Chess-playing with Open-CV [Human vs AI (Stockfish engine)]
Stars: ✭ 18 (-93.75%)
Mutual labels:  chess
NextCommunity.github.io
Join FREE: Community of open-source programmers and software engineers.
Stars: ✭ 29 (-89.93%)
Mutual labels:  chess
chess-puzzle-maker
Creates chess puzzles from chess games and positions
Stars: ✭ 34 (-88.19%)
Mutual labels:  chess
chess.ts
A Typescript chess library for chess move generation/validation, piece placement/movement, and check/checkmate/draw detection
Stars: ✭ 19 (-93.4%)
Mutual labels:  chess
AnimalChess
Animal Fight Chess Game(斗兽棋) written in rust.
Stars: ✭ 76 (-73.61%)
Mutual labels:  chess
ChessVisionBot
Chessbot using computer vision to play on any chess website
Stars: ✭ 32 (-88.89%)
Mutual labels:  chess
lila-gif
Webservice to render Gifs of chess positions and games, and stream them frame by frame
Stars: ✭ 63 (-78.12%)
Mutual labels:  chess
ChessLiteGUI
A lightweight Chess GUI for playing Chess on a personal computer.
Stars: ✭ 2 (-99.31%)
Mutual labels:  chess
realtimechess
In Real-time Chess (or Kung-Fu Chess, Ninja Chess), all pieces can be moved simultaneously!
Stars: ✭ 16 (-94.44%)
Mutual labels:  chess
coronate
A Swiss-style chess tournament management app.
Stars: ✭ 96 (-66.67%)
Mutual labels:  chess
ssh-chess
Chess over a ssh connection
Stars: ✭ 13 (-95.49%)
Mutual labels:  chess
Minic
A simple chess engine to learn and play with
Stars: ✭ 65 (-77.43%)
Mutual labels:  chess
TrulyQuantumChess
A game of truly quantum chess, with interference, entanglement, etc.
Stars: ✭ 77 (-73.26%)
Mutual labels:  chess
chessIO
Fast haskell chess move generator library and console UCI frontend
Stars: ✭ 25 (-91.32%)
Mutual labels:  chess
should-i-play-f6
Chess project to analyze the statistical effect of playing f3 (as white) or f6 (as black) on the outcome of the game.
Stars: ✭ 15 (-94.79%)
Mutual labels:  chess
stockfish-chess-web-gui
Responsive chess web GUI to play against the Stockfish 10 chess engine. Multiple web GUI implementations have also been included.
Stars: ✭ 21 (-92.71%)
Mutual labels:  chess
eschecs
UCI chess GUI
Stars: ✭ 32 (-88.89%)
Mutual labels:  chess

Play online chess with real chess board

Program that enables you to play online chess using real chess board. Using computer vision it will detect the moves you make on chess board. After that, if it's your turn to move in the online game, it will make the necessary clicks to make the move.

Setup

  1. Turn off all the animations and extra features to keep chess board of online game as simple as possible. You can skip this step if you enter your Lichess API Access Token.

  2. Take screenshots of chess board of online game at starting position, one for when you play white and one for when you play black and save them as "white.JPG" and "black.JPG" similar to the images included in the source code. You can skip this step if you enable "Find chess board of online game without template images." option or enter your Lichess API Access Token.

  3. Enable auto promotion to queen from settings of online game. You can skip this step if you enter your Lichess API Access Token.

  4. Place your webcam near to your chessboard so that all of the squares and pieces can be clearly seen by it.

  5. Remove all pieces from your chess board.

  6. Run "board_calibration.py"(Alternatively, click "Board Calibration" button in the GUI).

  7. Check that corners of your chess board are correctly detected by "board_calibration.py" and press key "q" to save detected chess board corners. You don't need to manually select chess board corners, it should be automatically detected by the program. The square covered by points (0,0), (0,1),(1,0) and (1,1) should be a8. You can rotate the image by pressing key "r" to adjust that. Example chess board detection result:

  8. Note that "constants.bin" file is created or modified.

Usage

  1. Place pieces of chess board to their starting position.
  2. Start the online game.
  3. Run "main.py"(Alternatively, click "Start Game" button in the GUI).
  4. Switch to the online game so that program detects chess board of online game. You have 5 seconds to do this step. You can skip this step if you enter your Lichess API Access Token.
  5. Wait until program says "game started".
  6. Make your move if it's your turn , otherwise make opponent's move.
  7. Notice that program actually makes your move on the internet game if it's your turn. Otherwise, wait until program says starting and ending squares of opponent's move.
  8. Go to step 6.

GUI

You can run "gui.py" to open the GUI. You can use it to do the steps in Setup and Usage sections and customize how you use the software. You can click "Start Game" button instead of running "main.py" and "Board Calibration" button instead of running "board_calibration.py". Also, you can enter your Lichess API Access Token via Connection→Lichess(You need to enable "Play games with the board API" while generating the token).

Video

In this section you can find video content related to the software.

Game against Stockfish 5 2000 ELO

Test game on chess.com

Test game on Lichess against Alper Karayaman

Game against Lionel45 on lichess org

Game against erpalazzi on Lichess

Play online chess with real chess board and web camera | NO DGT BOARD!

Frequently Asked Questions

What is the program doing? How it works?

It tracks your chess board via webcam. You should place it on top of your chess board. Make sure there is enough light in the environment and all squares are clearly visible. When you make a move on your chess board, it understands the move you made and transfers it to chess GUI by simulating mouse clicks(It clicks starting and ending squares of your move). This way, using your chess board, you can play chess in any chess program either websites like lichess.org, chess.com or desktop programs like Fritz, Chessmaster etc.

Placing webcam on top of the chess board sounds difficult. Can I put my laptop aside with the webcam in the laptop display?

Yes, you can do that with a small chess board. However placing webcam on top of the chess board is recommended. Personally, while using the program I am putting my laptop aside and it gives out moves via chess gui and show clocks. Instead of using laptop's webcam, I disable it and use my old android phone's camera as webcam using an app called DroidCam. I place my phone somewhere high enough(bookshelf for instance) so that all of the squares and pieces can be clearly seen by it.

How well it works?

Using this software I am able to make up to 100 moves in 15+10 rapid online game without getting any errors.

If I use the two exe-files (and not the py-files), where do I have to store the new white.JPG and black.JPG files?

If you use the two exe-files( "main.exe" and "board_calibration.exe") you should create a folder for them and put the two exe-files, "white.JPG" and "black.JPG" files into that folder.

I am getting error message "Move registration failed. Please redo your move." What is the problem?

Program asked you to redo your move because it understood that you made a move. However, it failed to figure out which move you made. This can happen if your board calibration is incorrect or color of your pieces are very similar to color of your squares. If latter is the case you will get this error message when playing white piece to light square or black piece to dark square.

Why it takes forever to detect corners of the chess board?

It should detect corners of the chess board almost immediately. Please do not spend any time waiting for it to detect corners of the chess board. If it can't detect corners of the chess board almost immediately, this means that it can't see your chess board well from that position/angle. Placing your webcam somewhere a bit higher or lower might solve the issue.

Required libraries

  • opencv-python
  • python-chess
  • pyautogui
  • mss
  • numpy
  • pyttsx3
  • scikit-image
  • pygrabber
  • mac-say
  • berserk
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].