Giter VIP home page Giter VIP logo

jchessboard's Introduction

JChessBoard

The JChessBoard is a js+canvas chessboard implementation.

I have been creating this project just for fun and for academic purposes.

Features

  • JCanvas as a graphical backend
  • Step validation
  • Step help (showing possible steps)
  • FEN - is a standard notation for describing a particular board position
  • The algebraic notation - is a method for recording and describing the moves in a game

Dependencies

Usage example

<!DOCTYPE html>
<html>
<head>
    <script src=jquery.js"></script>
    <script src="jcanvas.js"></script>
    <script src="jchessboard.js"></script>
</head>
<canvas width="512" height="512">
</canvas>
<script>
    var board = $('canvas').jschessboard().board;
    board.start();
</script>
</body>
</html>

Public methods

  • .start() - start a new game from the standard position
  • .fenToPosition() - convert a fen string to the board position
  • .positionToFen() - an opposite action to the previous fenToPosition
  • .clear() - clear the board
  • .move() - the main tool it moves a piece to a cell. a set of parameters can be: the algebraic notation or the cell number (a bitboard representation). Example: .move(52, 36) it is same as .move('e2e4') or .move('e4')

You can consult the source code for definition of additional actions and events.

Development

Want to contribute? Great!

Run in browser: tests/board/qunit.html tests/engine/qunit.html

Todo's

  • Fix broken tests
  • Add en passant support
  • Fix drag-n-drop freezes in firefox

License

This project is licensed under the terms of the MIT license.

jchessboard's People

Contributors

ghua avatar

Watchers

 avatar  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.