npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@tahdiislam/chess-play-online

v1.3.6

Published

React chessboard connected to a chess server.

Downloads

36

Readme

Chessboard

Easy-to-embed chessboard connected to a chess server.

Ready to npm install:

$ npm i @tahdiislam/chess-play-online

Demo

Setup

Thank you for your interest in this exciting project! Redux Chess is "just a chessboard" as lightweight as it can possibly be. It requires this chess server up and running as well as this chess API.

import React from "react";
import ReactDOM from "react-dom";
import { Chess } from "@tahdiislam/chess-play-online";

/* 

You have to set the playMethod with parameter. You can only set true for one method for one time. If you set one method is true other 3 will be false. You can not set true 2 or more method at one time. Also you can add 4 buttons in you app make it more user friendly.

*/

const props = {
  api: {
    prot: "https",
    host: "pchess.net",
    port: "443",
  },
  server: {
    prot: "wss",
    host: "pchess.net",
    port: "8443",
  },
  playMethod: {
    online: true,
    computer: false,
    playFriend: false,
    enterCode: false,
  },
};

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

Redux Chess sends messages to a WebSocket server. Make sure the WebSocket server is running on localhost as described next.

$ php cli/wss-server.php
Welcome to PHP Chess Server
Commands available:
/accept {"jwt":"<string>"} Accepts a request to play a game.
/draw {"action":["accept","decline","propose"]} Allows to offer a draw.
/heuristics {"movetext":"<string>"} Takes a balanced heuristic picture of the current game.
/heuristics_bar {"fen":"<string>","variant":"<string>"} Takes an expanded heuristic picture of the current position.
/leave {"action":["accept"]} Allows to leave a game.
/legal_sqs {"position":"<string>"} Returns the legal squares of a piece.
/online_games Returns the online games waiting to be accepted.
/play_lan {"color":"<string>","lan":"<string>"} Plays a chess move in long algebraic notation.
/randomizer {"turn":"<string>","items":"<string>"} Starts a random position.
/rematch {"action":["accept","decline","propose"]} Allows to offer a rematch.
/resign {"action":["accept"]} Allows to resign a game.
/restart {"hash":"<string>"} Restarts a game.
/start {"variant":["960","capablanca80","capablanca100","classical"],"mode":["analysis","gm","fen","pgn","play","stockfish"],"add":{"color":["w","b"],"fen":"<string>","movetext":"<string>","settings":"<string>","startPos":"<string>"}} Starts a new game.
/stockfish {"options":{"Skill Level":"int"},"params":{"depth":"int"}} Returns Stockfish's response to the current position.
/takeback {"action":["accept","decline","propose"]} Allows to manage a takeback.
/undo Undoes the last move.

Listening to commands...

Also, it sends HTTP requests to a REST API that needs to be setup as described in the README.md file.

License

The MIT License.