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. This can be seen illustrated below.
Chess pieces and their movements:
The game of chess has 6 unique types of pieces, with their own unique types
of movements. These are:
1.) King – Can move only 1 step at a time in all 8 directions (horizontal, vertical
and diagonal)
2.) Queen – Can move across the board in all 8 directions
3.) Bishop – Can move across the board only diagonally
4.) Horse – Can move across the board only in 2.5 steps (2 vertical steps and 1
horizontal step)
5.) Rook – Can move across the board only vertically and horizontally
6.) 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.
Your program should simulate the movement of each unique chess piece on an empty chessboard.
Assume that the board is empty. This means that the pawn cannot move diagonally.
Input – “King D5” Output – “D6, E6, E5, E4, D4, C4, C5, C6”
- Java 8u252
- Junit 5
- Mockito 2.2
- Maven
- slf4j