GithubHelp home page GithubHelp logo

ashishpapanai / chessjs Goto Github PK

View Code? Open in Web Editor NEW
25.0 0.0 14.0 4.45 MB

This engine has defeated Stockfish Level-6 which has 2300+ ELO rating with 1sec as thinking time. It is an implementation of Chess Engine in JavaScript by using Min Max Tree with Alpha-Beta pruning (GOFAI (Good Old-Fashioned Artificial Intelligence)). The front-end of the website is basic HTML and CSS. ChessJS Version 2 : v2.chessjs.tech

Home Page: https://www.chessjs.tech

License: Other

JavaScript 44.08% HTML 43.99% CSS 11.93%
gofai javascript ai chess chess-engine alpha-beta-pruning algorithm chess-js tree css html reinforcement-learning

chessjs's Introduction

DOI

chessJS: A GOFAI Chess Engine (2300+ ELO Rated*)

ChessJS: How to contribute to this repository

To contribute to this repository, follow the following steps:

  1. Fork this repository
  2. Clone the repository to your local machine
  3. Make necessary changes
  4. Commit the changes and add a branch pointing to this repository.
  5. Make a PR mentioning all the changes.
  6. If your PR makes a significant improvement and changes to the project without causing any break points the PR will be merged without any failure.

All we need is your contributions and patience.

Chess JS

Chess JS is a chess engine written in JavaScript. It works on Min-Max Searching in a tree, Min-Max is a Good Old Fashion Artificial Intelligence (GOFAI) algorithm. The algorithm is a naïve algorithm and for its optimization Alpha-beta pruning is incorporated.

Alpha-Beta pruning: This algorithm focuses in reducing the nodes visited in the depth-first search implementation used in the Min-Max Algorithm. Thus, without travelling the entire tree we make basic mathematical conclusions on the tree.

Rules of Chess: The Engine follows all rules of Chess specified by FIDE ( Fédération Internationale des Echecs : International Chess Federation), rules can be referred here.

UI and Styling Improvement: The styling of website till commit-6 (i.e. commit with heading Day 6) is based of simple HTML and CSS, all UI and UX Improvements made after this commit is based on Open Source Contributions from various communities.

Terms of Use:

All rules and regulations of Creative Commons Attribution-NonCommercial 4.0 International License, are applicable to use this repository.

FIDE prohibits use any engines or electronic device during any live or online rated/professional event, The owner holds no responsibility towards any such malpractices and restrains the use for only educational and training purposes.

For TL;DR conditions:

No part of this repository can be used without giving credits to the owner of this project and Bluefever Software.

The UI is copyrighted material of the owner and cannot be used without any written (handwritten or electronic) permission/approval from the owner.

Acknowledgement:

Special mention to Bluefever Software for putting an Informative walkthrough over his JavaScript chess engine and for a basic UI Implementation.

Special Thanks to Anshuman Pandey for being available to bug fixes to this project and drastically improving the styling of this project.

Special Thanks to Piyush Gupta for adding additional features to the website and providing valuable inputs in styling of this project.

This project wouldn't have been possible without referring additional websites and research papers from IBM DeepBlue, Deep Mind and Stockfish, Every details about the referred websites is smentioned in the references section.

*The Elo rating mentioned is an approximation based on a series of match conducted with varied difficulties of Stockfish conducted at Lichess.

References and Citations:

[1] D. E. Knuth and R. W. Moore, "An Analysis of Alpha-Beta Priming'," 1975.

[2] D. Silver et al., "A general reinforcement learning algorithm that masters chess, shogi and Go through self-play," 2018.

[3] M. Campbell, A. J. Hoane, and F. H. Hsu, "Deep Blue," Artif. Intell., 2002, doi: 10.1016/S0004-3702(01)00129-1.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

chessjs's People

Contributors

aayushibansal2001 avatar abhijay007 avatar allcontributors[bot] avatar ashishpapanai avatar crmsnbleyd avatar drishti307 avatar fatmab2809 avatar gupta-piyush19 avatar pandeymangg avatar somesh526 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chessjs's Issues

Add docker Support

Is your feature request related to a problem? Please describe.
Not related to a problem but an enhancement

Describe the solution you'd like
Adding a docker support will help contributors to test easily and deployment to cloud will become more simpler

Describe alternatives you've considered
Adding Dockerfile for docker support

Additional context
This would enable easy deployment and orchestration to cloud

Display tips on hovering over Buttons

Users might not be familiar with chess-based terms, and the reasons for the buttons present in the website.

Tips(what happens on clicking the buttons) should be displayed while hovering over them to make their actions clear.

Implementing Additional colour themes to the board

Allow the player to change the colour of the board from 3 colour themes?

  • Green (#254117)+ White (#FFFFFF)
  • Coffee (#6F4E37) + Blanched Almond (##FFEBCD)
  • Grey (#3D3C3A)+ White (FFFFFF)

Additional colour themes are welcome.

Create a Modal when game ends

Currently, we use browser alerts to tell the player if Game's Over by checkmate, or the game is drawn because of 3 fold repetition or 50 moves rule etc.

We want to switch to Modal based alerts in order to give a personalised alert to the user matching the theme of the website, We have already created a template model in js/model.js this can be used as a reference and new models for Victory, Loss or Draw can be created in a similar fashion.

Readme updation

The readme does not look so nice so can be improved by adding gifs and making orientation of things proper

Improve GUI

The current GUI of Engine is very minimalistic and simple, Contributors to this issue are supposed to follow the following task list, Contributions other than the mentioned tasks are always welcome. Details about the codebase are mentioned in the Daily Progress Report document, Any extra details can be mentioned in the comments of this issue.

  • Header with the Name of Engine and a tab to About Us section of the website

  • Footer Comprising details about copyright and Terms and Conditions as mentioned in the license.

  • Colourful and Creative background to enhance the UI of the website.

  • Change the font used on the website.

  • Improved about us page with subtle background and font.

Improving the About Us Section of the website.

Link to the about us page. About Us
The about us page is having a clean and subtle design but doesn't look connected to the Main vibe of the project. Contributors to this issue are expected to make it much more lively and related to chess and the main idea of the page.
The expected changes are:

  • Making the theme uniform and like the Home page of the website.
  • Improving the font and adding a background image / color as per the theme of the website.
  • Adding rules of chess to the about us page by using this pdf Rules a new page can be created as per the needs of the length of rules.
  • Adding the menu of the home page to the about page as well.

Adding Drag and Drop features to the pieces

JQuery offers certain tools to get the source i.e. the position from where the user started to drag to the position where the user has left the object.
ChessJS expects the participant to get the start and the end co-ordinates of the drag and drop so that the maintainers can work on implementing this feature.

People prefer dragging and dropping the pieces from the source to the destination of the piece to clicking the piece and the destination square.

Improve the responsiveness of the Website for users running it on non-standard devices

Currently, we are displaying a message that we prefer the user to use either a laptop or a pc with a certain resolution for best experience but that ruins the whole purpose of web and internet.

We don't have a sure shot solution to this problem, Any participant with Good command over JQuery and responsiveness can take up this issue and come up with a solution or any resolutions/ follow up so that we can take up the suggestion and start working on it.

Pawn promotion choices to the user in the UI

Currently, the pawn is by default promoted to the Queen. This enhancement expects the contributor to give the user a choice in the UI to choose the piece he wants his pawn to be promoted to.

The backend will be prepared for this accordingly by the contributor or the maintainers.

Add move sounds

Add move sounds that would play automatically after any piece is moved.

  • Sound for moves after the move is made by either side.

  • Different sounds for casting, piece capture, checks and checkmate

Remove outline from the buttons and add hover effects instead

Is your feature request related to a problem? Please describe.

when the user clicks on the button then the button gets cover with an outline which looks not that great. we can add a hover effect to the button instead which improves UI and it also improves user experience

Describe the solution you'd like

A clear and concise description of what you want to happen.

CSS changes required

Additional context
screenshots:

2021-01-14 (2)

Flip board button isn't flipping pieces

When a user clicks on the flip board function, the pieces aren't getting flipped, The clicks are rotated by 90 degrees.

The button intents to flip the board for the user so that he can rotate the board by 90 degrees and can change the side AI is playing to experience what AI could do in the situation of the human player.

Possible Fix:
A fix to this issue could be to reset the board and reprint the pieces according to the location before resetting the pieces.

To Reproduce
Steps to reproduce the behaviour:

  1. Go here or Clone the repository and run it on the live server or open index.html file
  2. Click on the Flip Board button on the website.
  3. See an error on moving the pieces.

Expected behaviour
The button intents to flip the board for the user so that he can rotate the board by 90 degrees.

Screenshots
After clicking the square on selecting the e2 square, the d2 square gets selected.
chess

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome
  • Version 87.0.4280.88

Additional context
A fix to this issue could be to reset the board and reprint the pieces according to the location before resetting the pieces.

Creating a single template for the GUI

Reason for proposed feature

  1. Currently, each page added has to be formatted separately, the complete HTML file has to be made from scratch.
  2. GUI on different pages aren't uniform

Proposed Solution/Feature
A single template for all the HTML pages should be created, to ensure uniformity and avoid redundancy.
Jinja Template Inheritance can be used for this feature, with a simple backend in Flask (for rendering the template).
Any approved Frontend/Interface features common to the whole application can be added to the template.

Adding timer for creating time controlled variants in the game.

With the evolution of chess different variants have come up and are recognised by FIDE. ChessJS is expected to add these time control with the help of contributors.

Needed time controls:

  • Classical: No time control or 30 minutes with 20-second increment after each move for either side.
  • Rapid: 15 mins with 10 seconds increment after each move for either side.
  • Blitz: 5 mins with 10 seconds increment after each move for either side.
  • Bullet: 2 mins with 10 seconds increment after each move for either side.

The game will end after the timer of any side runs out and the side with time left on the clock will be declared as the winner.

The timer needs to be displayed to both the user at the top right corner of the board for black and bottom right for the white pieces.

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.