GithubHelp home page GithubHelp logo

nitin-rachabathuni / chess Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kbjorklu/chess

0.0 0.0 0.0 92 KB

JavaScript Chess

Home Page: http://www.iki.fi/kbjorklu/chess/

License: MIT License

Shell 0.73% JavaScript 90.86% CSS 5.94% HTML 2.46%

chess's Introduction

JavaScript Chess

This program is a JavaScript implementation of the board game Chess, with a computer player opponent. All move types are supported, including en passant, castling and promotion.

Try it out here. Usage is shown below the chessboard. At least Internet Explorer (8 or later), Chrome and Firefox should work.

Code Structure

Source files are placed in the src directory. Minification and linting files are placed in the build directory. Source file contents:

  • chess.js: Constants, utilities and the Chess namespace.
  • bitboard.js: 64-bit bit twiddling tools.
  • zobrist.js: Game state hash calculator. Currently only used for the threefold repetition rule, but will be used in the transposition table implementation.
  • move.js: Piece movement representation.
  • position.js: Chess game state and mutation.
  • parser.js: Parser for various Chess notations.
  • ai.js: Artificial intelligence, i.e. computer opponent. Basic alpha-beta pruned minimax with a simple evaluation function.
  • ui.js: User interface code.
  • chess.include.js: Includes all of the above files.
  • chess.css: User interface style.
  • chess.ico: Icon.
  • chess.html: Main game file.
  • test.js: Automated tests.
  • test.html: Automated test runner.

Building

To compile the minified version using compile.sh in the build directory, you need bash and the Closure compiler. You may need to adjust the .jar location in compile.sh. Compiled files are placed in the top-level directory.

To lint using lint.sh in the build directory, you need bash and JavaScript Lint. You may need to adjust lint's path in lint.sh.

To run the tests, open test.html in the src directory.

TODO

  • Static exchange evaluation
  • Transposition table
  • Iterative deepening
  • Negamax formulation
  • AI randomness
  • Take game phase into account in evaluation
  • Take mobility into account in evaluation
  • Killer heuristic
  • Late-check castling legality
  • Tie-detection
  • Move pieces without drag and drop
  • Underpromotion
  • Show captured pieces in the UI
  • Don't hardcode board target div to UI
  • UI for loading game state from parsable Chess notation(s)
  • More tests

License

The Chess implementation is distributed under the MIT license. See accompanying LICENSE file for details.

Third-party components are distributed/used under their respective license:

  • jQuery: MIT (used via jQuery CDN)
  • jQuery UI: MIT (used via jQuery CDN)
  • jQuery UI Touch Punch: MIT (used via CloudFlare CDN)
  • Augment.js: MIT (used via CloudFlare CDN)
  • QUnit: MIT (used via jQuery CDN)
  • The jQuery extern file in the build directory: Apache 2

chess's People

Contributors

kbjorklu avatar

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.