/chess-ai

A real time chess game which you can play with friend or an AI bot. The games are stored and can further analyzed.

Primary LanguageJavaScriptMIT LicenseMIT


Logo

Chess.ai

A real time chess game which you can play with friend or an AI bot.

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact

About The Project

Chess.ai is a portal in which you can play chess with a friend or with a bot. You can sign up on the portal using simple user name and password. The bot uses minimax algorithm with alpha beta pruning and is hosted on backend. The games played are stored in a NoSQL database, which your can retrieve and analyze.


Home Page


Play with AI


Play with Friend


Here are some issues in the project which you can contribute on :

  • The AI needs to be optimized. Currently it takes 1-2 seconds for inference.
  • There is a timer of 5 minutes during which you can decide your next move. The timer should be variable according to user needs.
  • I am not a professional chess player. I have implemented all the rules of the game as well as castling, en passant and pawn promotion.But still if you feel some rule of the game is missing or not working as expected, do contribute. Such fixes of features are always welcome !

Contributing guidelines are given below.

(back to top)

Built With

(back to top)

Getting Started

Prerequisites

Following packages need to be installed in order for the app to run.

  • node-js
  • mongo-db
  • npm
    npm install npm@latest -g
  • docker (optional)

Steps for running the app

Without docker

  1. Clone the repo
    git clone https://github.com/rohan-naik07/chess-ai.git
  2. Install all the node packages in the root folder
     npm install
  3. Create .env file in root folder set up environment variables
     REACT_APP_sURL=http://localhost:7000 # backend url
     REACT_APP_URL=http://localhost:3000  # frontend url
  4. Install all the node packages in the backend folder
    cd backend
    npm install
  5. Create .env file in backend folder set up environment variables
     jwt_key=key # secret key for generating and verifying jwt tokens
     db_URL=mongodb://mongo:27017/test # db url
  6. Start react app
    npm start
  7. Start backend
    cd backend
    npm start

With docker
Make sure that docker is running.

  1. Clone the repo
    git clone https://github.com/rohan-naik07/chess-ai.git
  2. Run docker compose
     docker-compose up

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

Usage

  1. Create an account
  2. Search for user, choose your color and copy the generated link
  3. Select on a piece you want to move, the cell will become grey
  4. Now click on the cell you want to place the selected piece, the piece will move on that cell.
  5. You can undo your moves and abandon the game as well
  6. View or delete the stored game
  7. Logout

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Rohan Naik - https://www.linkedin.com/in/rohan-naik07/

Project Link: - https://github.com/rohan-naik07/chess-ai

(back to top)