0.9.1 • Published 6 years ago

react-pgn-chess v0.9.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

React PGN Chess

React PGN Chess

Renders a chess board that emits PGN signals on every move made by players. It is designed to be used with PGN Chess, which is a PHP chess board representation that runs games internally in PGN notation.

React PGN Chess is still on development at this moment, please patient. Contributions are welcome!

1. Installation

npm install --save react-pgn-chess

2. Usage

import React from 'react';
import ReactDOM from 'react-dom';
import Board from './components/Board.js';
import './index.css';

var BoardElement = React.createElement(Board, {server: "ws://localhost:3001"});

ReactDOM.render(
  BoardElement,
  document.getElementById('chess-board')
);

React PGN Chess

React PGN Chess assumes there is a websocket server running on localhost:3001. The connection listens to messages as the ones described below:

w e4
b e5
w Nf3
b Rg1

Responding like this:

true
true
true
false

As you see, React PGN Chess is a GUI implemented with React that speaks to a PHP chess server through a websocket. Yep, this is a server-side app, so what about the server side?

Have a look at PhpChessJs and see how te pieces of the puzzle fit together! Here, you'll find a simple chess server implemented with Ratchet, which is a PHP websocket library, and using PGN Chess as the chess board representation.

The idea behind PhpChessJs puts the focus on writing all chess logic on the server side, and can be used as a basis for implementing computationally heavy chess algorithms that can take a few seconds to calculate a move.

3. Demo

Soon available.

4. License

The MIT License (MIT) Jordi Bassagañas.

5. Contributions

Would you help make this library better?

  • Feel free to send a pull request
  • Drop an email at info@programarivm.com with the subject "React PGN Chess"
  • Leave me a comment on Twitter
  • Say hello on Google+

Thank you.