0.9.56 • Published 3 years ago

redux-chess v0.9.56

Weekly downloads
-
License
MIT
Repository
github
Last release
3 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

3 years ago

0.9.55

3 years ago

0.9.53

3 years ago

0.9.54

3 years ago

0.9.52

3 years ago

0.9.51

3 years ago

0.9.50

3 years ago

0.9.49

3 years ago

0.9.47

3 years ago

0.9.48

3 years ago

0.9.45

3 years ago

0.9.46

3 years ago

0.9.44

3 years ago

0.9.43

3 years ago

0.9.41

3 years ago

0.9.42

3 years ago

0.9.40

3 years ago

0.9.38

3 years ago

0.9.39

3 years ago

0.9.36

3 years ago

0.9.37

3 years ago

0.9.35

3 years ago

0.9.34

3 years ago

0.9.32

3 years ago

0.9.33

3 years ago

0.9.31

3 years ago

0.9.30

3 years ago

0.9.29

3 years ago

0.9.28

3 years ago

0.9.27

3 years ago

0.9.26

3 years ago

0.9.24

3 years ago

0.9.25

3 years ago

0.9.23

3 years ago

0.9.22

3 years ago

0.9.20

3 years ago

0.9.21

3 years ago

0.9.17

3 years ago

0.9.18

3 years ago

0.9.19

3 years ago

0.9.15

3 years ago

0.9.16

3 years ago

0.9.14

3 years ago

0.9.13

3 years ago

0.9.9

3 years ago

0.9.8

3 years ago

0.9.7

3 years ago

0.9.6

3 years ago

0.9.5

3 years ago

0.9.4

3 years ago

0.9.3

3 years ago

0.9.2

3 years ago

0.9.1

3 years ago

0.9.0

3 years ago