0.9.56 • Published 4 years ago

redux-chess v0.9.56

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Redux Chess

React chessboard connected to a PHP Chess server.

Install

Via npm:

$ npm i redux-chess

Demo

Check out this demo.

Please note the sandbox server may not be up and running all the time.

Figure 1 Figure 1. The Chigorin Defense to the Queen's Gambit

Figure 2 Figure 2. Evaluation after 1.d4 d5 2.c4 Nc6 3.cxd5 Qxd5 4.e3 e5 5.Nc3 Bb4 6.Bd2 Bxc3

Examples

Initialization with the sandbox chess server:

import React from 'react';
import ReactDOM from 'react-dom';
import { Chess } from 'redux-chess';

const props = {
  server: {
    prot: 'wss',
    host: 'pchess.net',
    port: '8443'
  }
};

ReactDOM.render(
  <Chess props={props} />,
  document.getElementById('redux-chess')
);

Initialization with a custom local chess server:

import React from 'react';
import ReactDOM from 'react-dom';
import { Chess } from 'redux-chess';

const props = {
  server: {
    port: 'ws',
    host: '127.0.0.1',
    port: '8080'
  }
};

ReactDOM.render(
  <Chess props={props} />,
  document.getElementById('redux-chess')
);

Learn More

Thank you for your interest in this exciting project!

It may appear as if being quite challenging provided it requires this chess server up and running. redux-chess is "just a chessboard" as lightweight as it can possibly be.

The chessboard just sends messages to a WebSocket server so make sure the chess server is running on localhost:

$ php cli/ws-server.php
Welcome to PHP Chess Server
Commands available:
/accept {"id":"id"} Accepts a friend request to play a game.
/ascii Prints the ASCII representation of the game.
/castling Gets the castling status.
/captures Gets the pieces captured by both players.
/fen Prints the FEN string representation of the game.
/heuristicpicture Takes a balanced heuristic picture of the current game.
/history The current game's history.
/ischeck Finds out if the game is in check.
/ismate Finds out if the game is over.
/piece {"position":"string"} Gets a piece by its position on the board.
/pieces {"color":["w","b"]} Gets the pieces on the board by color.
/playfen {"fen":"string"} Plays a chess move in shortened FEN format.
/quit Quits a game.
/start {"mode":["analysis","loadfen","playfriend"],"fen":"string","color":["w","b"],"min":"int"} Starts a new game.
/status The current game status.

Listening to commands...

For further information on developing this awesome npm package, you're all invited to read my learning journey:


License

The MIT License.

Contributions

Would you help make this app better?

  • Look at the open issues
  • Send a pull request
  • Drop an email
  • Leave me a comment on Twitter

Happy learning!

Thank you, and keep it up.

0.9.56

4 years ago

0.9.55

4 years ago

0.9.53

4 years ago

0.9.54

4 years ago

0.9.52

4 years ago

0.9.51

4 years ago

0.9.50

4 years ago

0.9.49

4 years ago

0.9.47

4 years ago

0.9.48

4 years ago

0.9.45

4 years ago

0.9.46

4 years ago

0.9.44

4 years ago

0.9.43

4 years ago

0.9.41

4 years ago

0.9.42

4 years ago

0.9.40

4 years ago

0.9.38

4 years ago

0.9.39

4 years ago

0.9.36

4 years ago

0.9.37

4 years ago

0.9.35

4 years ago

0.9.34

4 years ago

0.9.32

4 years ago

0.9.33

4 years ago

0.9.31

4 years ago

0.9.30

4 years ago

0.9.29

4 years ago

0.9.28

4 years ago

0.9.27

4 years ago

0.9.26

4 years ago

0.9.24

4 years ago

0.9.25

4 years ago

0.9.23

4 years ago

0.9.22

4 years ago

0.9.20

4 years ago

0.9.21

4 years ago

0.9.17

4 years ago

0.9.18

4 years ago

0.9.19

4 years ago

0.9.15

4 years ago

0.9.16

4 years ago

0.9.14

4 years ago

0.9.13

4 years ago

0.9.9

4 years ago

0.9.8

4 years ago

0.9.7

4 years ago

0.9.6

4 years ago

0.9.5

4 years ago

0.9.4

4 years ago

0.9.3

4 years ago

0.9.2

4 years ago

0.9.1

4 years ago

0.9.0

4 years ago