Code Monkey home page Code Monkey logo

react-chess's Introduction

React Chess

Two player chess game built with React js.

How To Install And Run Locally

  • Pull the project and cd into it
  • Install packages with npm install
  • Finally npm run start, which will start hot reloading, and fire up browser with http://localhost:3000/

How It's Built

The components boilerplate structure consisting of Game, Board and Square is same as of Facebook tic tac toe tutorial.

ES6 classes have been used for chess pieces. Piece is a parent class to which King, Queen, Bishop, Knight, Rook and Pawn extend. Board of squares is filled with these pieces and null.

Game component maintains the board of squares filled with pieces, and handles turn and move of both players.

Each piece implements isMovePossible(src, dest) and getSrcToDestPath(src, dest) methods which Game uses to identify legality of move and to render UI accordingly.

To Dos

  • Implement a method in Game that returns true if this move exposes the player's king to check. Use it to disallow the move and inform user.
  • Write unit tests

Demo

http://www.talhaawan.net/react-chess/

Blog Post

https://www.techighness.com/post/develop-two-player-chess-game-with-react-js/

react-chess's People

Contributors

talhaawan avatar nologictheone avatar fullchee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.