Python

Question

URGENT

In PYTHON

Check Base Code in Attachments

1-) Write a function place _piece which takes as parameters:

e: a list of lists representing the chessboard,

coord: a pair of integers (tuple) representing the element of the list of lists that we want to modify,

piece: a character string that represents the piece.

This function returns True if the list of lists has been modified, False otherwise.

For a coordinate, we call row the first element of the couple, column the second. The line corresponds to

sublist number in the list of lists, the column to the item number in that sublist.

This function simply places piece at the given coordinates, after checking the validity of coordinates. Yes

the integers in coord are not between 0 and 7, the function returns False without modifying e. Otherwise she

modifies the element of e and makes True.

2-) In chess, a cell is designated by a column name (A, B, in the reverse order of the lines to that used previously and starting at 1). In the following we call this , ..., H) and row number (1,2, ..., 8) (in that order, so numbering system algebraic notation. Given the usual representation of the game 'chess, with the white players at the bottom, we have the correspondence next • the columns are denoted A, .., H. The letter 'A' corresponds to column 0, 'H' to column 7 in the list of lists. • the rows are denoted 1, ..., 8. Row 1 corresponds to row 7, row 8 corresponds to row 0. For example, box "B5" corresponds to coordinates (3, 1). Write a function convert to coord which takes as parameter an algebraic notation, i.e. a string of two characters made up of a letter (A-H) and an integer (1-8), and returns the coordinate of the cell in the matrix. We assumes the algebraic notation is correct. Note: you can use the ASCII code of the letter to obtain the corresponding integer.

3-) We can write a function that makes a list of boxes accessible to a lady whose position we know. The functions you are asked to write in this exercise do not need to know the state of the board. All positions are expressed in coordinates (pairs of integers, no algebraic notation). We are you request to write intermediate functions to facilitate the writing of the lady movement.

4-) • Write a function move_lig which takes a pair of coordinates as a parameter and returns the list of coordinates of all cells that have the same row number as given in coord, excluding the position coord. • Likewise, write a mov col function which takes a pair of coordinates as a parameter and returns the list of coordinates of all cells that have the same column number as that given in coord, excluding the coordinate position

5-) • Write a function move diag which takes as parameter a pair of coordinates and returns the list of coordinates of squares accessible diagonally and anti-diagonally from coord, excluding coord

6-) Using the three previous functions, write a lady move function which takes as a parameter the position of the lady and returns the list of squares she was able to reach, excluding her own position.

7-) We ask ourselves the following question: given several ladies places on the chessboard, can they be taken?

Write an entered function which takes as a parameter an integer n which represents the number of queens to be placed in the chessboard The function asks the user to enter the position of a lady in algebraic notation, n times. It returns the list of positions in matrix notation, i.e. after having converted each of the algebraic notations into matrix coordinates

8-) Write a collision function. A collision indicates that a lady could take another. The function supports sets the list of checker positions in matrix coordinates. This list comes from the previous entry. The function returns True if the position of at least one of the ladies is equal to the positions that the other ladies, False otherwise.

Please do as much as you can

Details
Attachments
Purchase An Answer Below

Have a similar question?