Skip to content

codewithsom/Chess-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multiplayer Chess Game ♛♜♞♝♟♚

Overview :

  • Chess is a two-player strategy board game that is played on an 8x8 checkerboard. There is a set of rules that define the game, but an infinite number of possibilities in which the game can proceed depending on the moves made by the two players.

Chess-Board

What Are The Chess Pieces?

  • The chess pieces are what you move on a chessboard when playing a game ofchess. There are six different types of chess pieces. Each side starts with 16 pieces : Eight Pawns, Two Bishops, Two Knights, Two Rooks, One Queen, and One King.

The Pawn :

  • When a game begins, each side starts with eight pawns. White's pawns arelocated in the second rank, while Black's pawns are located in the seventh rank. Thepawn is the least powerful piece and is worth one point. If it is a pawn's first move,it can move forward one or two squares. If a pawn has already moved, then it canmove forward just one square at a time. It attacks (or captures) each square diagonally to the left or right

The Bishop :

  • Each side starts with two bishops, one on a light square and one on a darksquare. When a game begins, White's bishops are located on c1 and f1, whileBlack's bishops are located on c8 and f8. The bishop is considered a minor piece(like a knight) and is worth three points. A bishop can move diagonally as manysquares as it likes, as long as it is not blocked by its own pieces or an occupiedsquare. An easy way to remember how a bishop can move is that it moves like an"X" shape. It can capture an enemy piece by moving to the occupied square wherethe piece is located.

The Knight :

  • Each side starts with two knights—a king's knight and a queen's knight.When a game starts, White's knights are located on b1 and g1, while Black'sknights are located on b8 and g8. The knight is considered a minor piece (like abishop) and is worth three points. The knight is the only piece in chess that canjump over another piece! It moves one square left or right horizontally and then twosquares up or down vertically, OR it moves two squares left or right horizontally andthen one square up or down vertically—in other words, the knight moves in an"L-shape." The knight can capture only what it lands on, not what it jumps over!

The Rook :

  • Each side starts with two rooks, one on the queenside and one on thekingside. All four rooks are located in the corners of the board. White's rooks startthe game on a1 and h1, while Black's rooks are located on a8 and h8. The rook isconsidered a major piece (like the queen) and is worth five points. It can move asmany squares as it likes left or right horizontally, or as many squares as it likes up ordown vertically (as long as it isn't blocked by other pieces).

The Queen :

  • The queen is the most powerful chess piece! When a game begins, each sidestarts with one queen. The white queen is located on d1, while the black queen islocated on d8. The queen is considered a major piece (like a rook) and is worth ninepoints. It can move as many squares as it likes left or right horizontally, or as manysquares as it likes up or down vertically (like a rook). The queen can also move asmany squares as it likes diagonally (like a bishop).

The King :

  • The king is the most important chess piece. The goal of a game of chess is tocheckmate the king. When a game starts, each side has one king. White's king is located on e1, while Black's king starts on e8. The king is not a very powerful piece,as it can only move (or capture) one square in any direction. When a king is attacked, it is called a "check".

Game Rules :

  • The chessboard is two-dimensional of size 8x8 and has 64 squares where the pieces can stand.
  • There are two online players, where one player controls the white pieces and the other player controls the black pieces. The colour is assigned randomly to the players.
  • Each player gets alternate turns, starting with the white side.
  • There are 6 types of chess pieces on the board: king, queen, knight, bishop, rook and pawn.
  • At the start of the game, each player has 1 king, 1 queen, 2 knights, 2 bishops, 2 rooks and 8 pawns.
  • Each piece can only move according to its own fixed rules.
  • A piece can be captured if the opponent player’s piece moves to its current position.
  • Once a piece is captured, it’s removed from the chessboard.
  • There’s no option to cancel once a move is made.
  • There can be two outcomes of the game: checkmate (one side wins) or stalemate (draw).
  • Once an outcome is achieved, the game ends.

Tech Stack :

Node JS :

  • Node.js is an open-source and cross-platform JavaScript runtimeenvironment. It is a popular tool for almost any kind of project!
  • Node.js runs the V8 JavaScript engine, the core of Google Chrome, outside ofthe browser. This allows Node.js to be very performant.
  • A Node.js app runs in a single process, without creating a new thread forevery request. Node.js provides a set of asynchronous I/O primitives in itsstandard library that prevent JavaScript code from blocking and generally,libraries in Node.js are written using non-blocking paradigms, makingblocking behaviour the exception rather than the norm.
  • When Node.js performs an I/O operation, like reading from the network,accessing a database or the filesystem, instead of blocking the thread and wasting CPU cycles waiting, Node.js will resume the operations when theresponse comes back.
  • This allows Node.js to handle thousands of concurrent connections with asingle server without introducing the burden of managing threadconcurrency, which could be a significant source of bugs.
  • Node.js has a unique advantage because millions of frontend developers thatwrite JavaScript for the browser are now able to write the server-side code inaddition to the client-side code without the need to learn a completelydierent language.
  • In Node.js the new ECMAScript standards can be used without problems, asyou don't have to wait for all your users to update their browsers - you are incharge of deciding which ECMAScript version to use by changing the Node.jsversion, and you can also enable specific experimental features by runningNode.js with flag.

Socket Programming :

  • A socket is a communication connection point (endpoint) that you can nameand address in a network. Socket programming shows how to use socketAPIs to establish communication links between remote and local processes.
  • The processes that use a socket can reside on the same system or dierentsystems on dierent networks. Sockets are useful for both stand-alone andnetwork applications. Sockets allow you to exchange information betweenprocesses on the same machine or across a network, distribute work to themost ecient machine, and they easily allow access to centralised data.Socket application program interfaces (APIs) are the network standard forTCP/IP. A wide range of operating systems support socket APIs. i5/OSsockets support multiple transports and networking protocols. Socket system functions and the socket network functions are thread-safe.

Socket-Programming-with-Nodejs

Screenshots of Game :

Screenshot (3)

Screenshot (5)

Screenshot (7)

Screenshot (6)

To Run the Project :

npm i
node src/main.js

References :

About

It is an Online Multiplayer Chess Game Website.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published