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

rsg-chess

v1.1.0-alpha.2

Published

Useful chess APIs ...for everyone

Downloads

38

Readme

RSG-Chess-API

Chess APIs based on RSG Chess

Installation

// via NPM
npm install rsg-chess
// via Yarn
yarn add rsg-chess
// via CDN
<script src="https://storage.googleapis.com/rsg-chess-api/cdn/index.min.js">

Usage

Import the modules

// ES6
import { Game, AI, Pieces, tools } from "rsg-chess";

// NodeJS
const { Game, AI, Pieces, tools } = require("rsg-chess");

// CDN
// The `RSGChess` global variable can be used once, after all scripts have loaded successfully
var Game = RSGChess.game;
var AI = RSGChess.AI;
// ect.

Use the functions

To use our API take a look at the docs and the supported functions!

Example:

// ES6
const game = Game.prototype.initializeGame();
game.moveSelected(
  game.board[6][0], { y: 5, x: 0 }, () => {}, () => {}, false, false
)
...

// Node.JS
const game = RSGChess.Game.prototype.initializeGame();
game.moveSelected(
  game.board[6][0], { y: 5, x: 0 }, () => {}, () => {}, false, false
)
...

// Standard JS
var game = RSGChess.Game.prototype.initializeGame();
// RSGChess is a global variable
game.moveSelected(
  game.board[6][0], { y: 5, x: 0 }, () => {}, () => {}, false
)

Releases and changelog

Docs

Documentations, Get Started guides and tutorials are available on http://rsg-chess.now.sh/docs/api/

Note that the docs are not completed yet and may contain wrong links and broken demos.

Supported functions

Game logic and controls

  • new Game (promoCallback)
  • Game.prototype.initializeGame
  • Game.prototype.piece (type, x, y, color)
  • Game.prototype.moveSelected (selected, to, promotionCallback, checkmateCallback, simulate)
  • Game.prototype.promotePawn (pawn, x, y, color, type)
  • Game.prototype.simulateAndFilter (moves, piece)
  • Game.prototype.checkmate (color)
  • Game.prototype.simpleMovePiece (piece, from, to)
  • Game.prototype.warning (color)
  • Game.prototype.allMoves

notations and rules

  • Game.prototype.threefoldCheck
  • Game.prototype.halfmoveClock
  • Game.prototype.castlingTarget
  • Game.prototype.enPassantTarget
  • Game.prototype.fullmoveCount
  • Game.prototype.pieceToAN (x, y)
  • Game.prototype.boardToFEN
  • Game.prototype.activeColour
  • Game.prototype.gameToFEN

Game.prototype variables

  • game.board
  • game.turn
  • game.threefold
  • game.FEN and game.FENboard

AI

  • The AI method.
    • syntax and input: AI(depth, gameState, isMaximisingPlayer)
    • output: bestmove { from, to }

Tools

Sometimes you need to manage a lot of different indications such as app performance, AI speed, bundle file size, battery life and more. That's why we've added tools to RSG Chess API as built-in methods or external plugins. With them you can run more complex tasks (transfer data from/to servers/back-ends, using workers and threads or databases), manage the performance and improve the speed of the app.

  • uncycleBoard(boardObject)
  • uncycleTurns(turnObject)

These two methods remove the cyclic game references from the board and turn objects so you can stringify them, send via HTTP requests or even save as cookies for later usage.

This API is officially powering the RSG Chess mobile app and the rest of the "RSG Chess family"

  • Gitub: https://github.com/RSG-Group/RSG-Chess-mobile
  • Google Play Store: https://play.google.com/store/apps/details?id=com.rsg.chess
  • Amazon AppStore: https://www.amazon.com/RSG-Group-Chess/dp/B07D1KWTK7

Additional links