Simple command line based application to simulate the movement of various chess pieces on chess board
Create a program, which simulates a chessboard and the movements of various types of pieces on the chessboard.
The chessboard is an 8 x 8 grid with 64 cells in it. With 8 rows (A, B, C.... H) and 8 columns (1, 2, 3.... 8), each cell can be uniquely identified with its cell number.
The game of chess has 6 unique types of pieces, with their own unique types of movements. These are:
- King – Can move only 1 step at a time in all 8 directions (horizontal, vertical and diagonal)
- Queen – Can move across the board in all 8 directions
- Bishop – Can move across the board only diagonally
- Knight – Can move across the board only in 2.5 steps (2 vertical steps and 1 horizontal step)
- Rook – Can move across the board only vertically and horizontally
- Pawn – Can move only 1 step at a time, in the forward direction, vertically. Can also move 1 step forward diagonally, in order to eliminate an opposing piece.
- NodeJS version 12.15 or higher - Install Link
- NPM Version 6.14.6 or higher - (Comes bundle with NodeJS)
- The solution for this problem is developed using NodeJS with Typescript.
- Additional libraries / npm packages used are :
- Prompt-Sync : To get input from the user.
- Chalk : For better visual representation of the output.
- Table: For displaying chessboard on console.
- Development dependencies
- Typescript
- ts-node
- Eslint
- Prettier
To run this programme clone this repository then execute the following commands
To install all the dependencies.
npm install
To transpile the typcript code to javascript.
npm run build
To start the programme.
npm start