All Projects → ruilisi → React Chessground

ruilisi / React Chessground

Licence: gpl-3.0
React wrapper of Chessground

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Chessground

Chessandcard 2dx
收集 cocos2d-x 的棋牌项目,投稿啊,投稿。
Stars: ✭ 477 (+571.83%)
Mutual labels:  chess
Colamone js
A two-player strategy board game /オリジナルのボードゲームを作ってみる。
Stars: ✭ 13 (-81.69%)
Mutual labels:  chess
Galvanise zero
Learning from zero (mostly based off of AlphaZero) in General Game Playing.
Stars: ✭ 60 (-15.49%)
Mutual labels:  chess
Realchess
Mod for Minetest to play a realistic chess game (GUI-based)
Stars: ✭ 5 (-92.96%)
Mutual labels:  chess
Ancientbeast
Turn Based Strategy Game. Master your beasts! 🐺
Stars: ✭ 907 (+1177.46%)
Mutual labels:  chess
Countergo
UCI chess engine (golang)
Stars: ✭ 32 (-54.93%)
Mutual labels:  chess
Stockfish Mac
Beautiful, powerful chess app for the Mac
Stars: ✭ 404 (+469.01%)
Mutual labels:  chess
Pgn2gif
A small tool that generates gif of a chess game
Stars: ✭ 65 (-8.45%)
Mutual labels:  chess
Game Server
Distributed Java game server, including cluster management server, gateway server, hall server, game logic server, background monitoring server and a running web version of fishing. State machine, behavior tree, A* pathfinding, navigation mesh and other AI tools
Stars: ✭ 916 (+1190.14%)
Mutual labels:  chess
Lichobile
lichess.org mobile application
Stars: ✭ 1,043 (+1369.01%)
Mutual labels:  chess
Reddit Pgn To Gif
Converts PGN from /r/chess into gifs hosted on imgur and leaves a reddit comment
Stars: ✭ 16 (-77.46%)
Mutual labels:  chess
Chess Variants Training
Chess Variants Training is a website where you can improve at chess variants.
Stars: ✭ 18 (-74.65%)
Mutual labels:  chess
Sunfish rs
Rust rewrite of the sunfish simple chess engine
Stars: ✭ 41 (-42.25%)
Mutual labels:  chess
Chessground
Mobile/Web chess UI for lichess.org
Stars: ✭ 503 (+608.45%)
Mutual labels:  chess
Chessli
A free and open source chess improvement app that combines the power of Lichess and Anki.
Stars: ✭ 64 (-9.86%)
Mutual labels:  chess
Pychess
PyChess - a chess client for Linux/Windows
Stars: ✭ 414 (+483.1%)
Mutual labels:  chess
Cc65 Chess
Portable chess game in C. Commodore 64, Apple 2, Atari, Oric, Commander X16, curses terminal, etc.
Stars: ✭ 21 (-70.42%)
Mutual labels:  chess
Lichs
♟ Play chess against real players in your terminal using Lichess
Stars: ✭ 70 (-1.41%)
Mutual labels:  chess
Download
UI mod for Dota 2 Auto Chess that adds several QoL improvements to the UI
Stars: ✭ 65 (-8.45%)
Mutual labels:  chess
Ostinato
A chess library that runs on the server (Scala) and on the browser (ScalaJS).
Stars: ✭ 42 (-40.85%)
Mutual labels:  chess

React Chessground

react-chessground is a react wrapper of the awesome Chessground

Installation

npm install --save react-chessground

Example

  • An example of playing with random opponent is provided in example

Usage

import Chessground from 'react-chessground'
import 'react-chessground/dist/styles/chessground.css'

class Demo extends React.Component {
  render () {
    return <Chessground />
  }
}

Properties

  • onMove - function Function is called when user moves a piece to a new position. Receives two parameters:
    • from - string Previous square position
    • to - string New square position
  • randomMove - function Function is called when computer moves a piece to a new position. Contains two objects:
    • moves - object Stores all valid moves
    • move - object Generates a move chosen from moves randomly
  • promotion - function Provides choices for pawn's promotion. Receive one parameter:
    • e - string Stores pieces user might want to choose upon promotion
  • reset - function Function is called when reset button clicked
  • undo - function Function is called when undo button clicked. Disabled when game is over

Reset: Reset the board to the initial starting position.

reset = () => {
    this.chess.reset()
    this.setState({ fen: this.chess.fen() })
  }

Undo: Take back the last half-move.

undo = () => {
    this.chess.undo()
    this.setState({ fen: this.chess.fen() })
  }

Promotion: Provides choices for pawn's promotion.

promotion(e) {
   const { chess } = this
   const from = this.pendingMove[0]
   const to = this.pendingMove[1]
   chess.move({ from, to, promotion: e })
   this.setState({
     fen: chess.fen(),
     lastMove: [from, to],
     selectVisible: false
   })
   setTimeout(this.randomMove, 500)
 }

Features

  • Display last move and check
  • Display move destinations, and premove destinations (hover effects possible)

It's available to see more features in Chessground

Documentation

Options of Chessground are mapped to properties of react-chessground

You can refer to documentation of Chessground for detailed configuration

An example of playing with random opponent is provided in example

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].