Giter VIP home page Giter VIP logo

play-online-chess-with-real-chess-board's Introduction

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.

  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.

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

  4. Remove all pieces from your chess board.

  5. Run "board_calibration.py".

  6. 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. Example chess board detection result:

  7. 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".
  4. Switch to the online game so that program detects chess board of online game. You have 5 seconds to do this step.
  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.

Required libraries

  • opencv
  • python-chess
  • pyautogui
  • mss
  • numpy
  • pyttsx3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.