Question: PLEASE HELP WITH THIS PYTHON PROJECT!! The following is the initial chess board position: This position (as well as other chess board positions) can be
PLEASE HELP WITH THIS PYTHON PROJECT!!
The following is the initial chess board position:

This position (as well as other chess board positions) can be described by the so-called FEN (ForsythEdwards Notation) notation:
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR
FEN consists of 8 substrings, separated by "/". Each substring describes the squares in a particular rank (row), starting at rank eight and finishing at rank 1. Each piece is identified by a single letter taken from the standard English names (pawn = "P", knight = "N", bishop = "B", rook = "R", queen = "Q" and king = "K"). White pieces are designated using upper-case letters ("PNBRQK") while black pieces use lowercase ("pnbrqk"). The digits 1 through 8 denote the number of empty squares in the given rank. In the initial position, there is "8" in ranks 6, 5, 4 and 3, thus denoting 8 empty squares in each of these ranks. The first substring ("rnbqkbnr") describes the contents of each square in rank 8 , the next substring ("pppppppp") the contents of rank 7, and so on down to rank 1 ("RNBQKBNR").
If we display this position using an ASCII chess board, it looks like this:

The string "abcdefgh" below the first rank denotes the files (columns) on the chess board and the numbers on the left denote the numbers for the ranks on the board.
To take another example, consider the position after these two moves: 1. e4 c5 2. Nf3 Nc6. The chess position is then:

The corresponding FEN is:
r1bqkbnr/pp1ppppp/2n5/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R
The corresponding ASCII chess board then looks like this:

Here you can see that there is one empty square in rank 8, denoted by "1" in r1bqkbnr. In rank 6, there are first two empty squares, then "n" (a black knight), followed by 5 empty squares, as indicated by the substring.
Note that a valid FEN string always denotes 8 squares for each of the ranks. The following is an example of an invalid FEN string:
rnbqkbnr/pppppppp/8/7/8/8/PPPPPPPPP/RNBQKBNR
In this string, there are only 7 squares in the 5th rank and 9 squares in the 2nd rank.
In this project, you implement a program, fen.py, which reads a single FEN string from the user and prints out the associated ASCII chess board. The program needs to be able to catch one type of error, i.e. a FEN string that denotes less or more than 8 squares in any of the ranks. If errors are found, the program does not print the chess board, but rather a list of the ranks that contain the errors, starting from the highest rank.

Hint: Represent the chess board as a list of strings, one string for each rank.
8 7 6 5 3 N A B C D E F G H 8 rnbqkbnr 7 pppppppp 6 5 4 3 2 PPPPPPPP 1 RNBQKBNR abcdefgh 8 7 6 5 8 3 N 8 & A B C D E F G H 8 r bqkbnr 1 pp ppppp 6 n 5 4 P 3 N 2 PPPP PPP 1 RNBQKB R abcdefgh Example input/output: Enter a FEN string: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR 8 rnbqkbnr 7 pppppppp 6 5 4 3 2 PPPPPPPP 1 RNBQKBNR abcdefgh Example input/output: Enter a FEN string: rnbqkbnr/pppppppp/8/7/8/8/PPPPPPPPP/RNBQKBNR Errors in ranks: [5, 2]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
