Question: Please solve using MATLAB. Write a function EightQueens(strArr). The input will be an array of the locations of eight queens on a standard 8x8 chess
Please solve using MATLAB. Write a function EightQueens(strArr). The input will be an array of the locations of eight queens on a standard 8x8 chess board. The structure of the strArr will be: ["(x,y)", "(x,y)", ...] where (x,y) represents the position of the current queen on the chessboard (x and y will both range from 1 to 8 where 1,1 is the top-left of the chessboard and 8,8 is the bottom-right). There will be no other pieces on the board.
Your program should determine if all the queens are placed in such a way that none of them are in a position to attack another (see example below). If this is true, then return the string true, else return false. (Optional) If false, return the last queen in the list that is attacking another piece in the original formatting (x,y).
For example: if strArr is ["(2,1)", "(4,2)", "(6,3)", "(8,4)", "(3,5)", "(1,6)", "(7,7)", "(5,8)"] then your program should return the string true.

using either Matlab or Python, write a function EightQueens strArr). The input will be an array of the locations of eight queens on a standard 8 8 chess board. The structure of the strArr will be: x y .y . J where (x.y) represents the position of the current queen on the chessboard (x and y will both range from 1 to 8 where 1,1 is the top-left of the chessboard and 8,8 is the bottom-right). There will be no other pieces on the board. Your program should determine if all the queens are placed in such a way that none of them are in a position to attack another (see example below). If this is true, then return the string true, else return false. (Optional) If false, retum the last queen in the list that is attacking another piece in the original formatting "(x,y)" For example: if strArr is ["(2,1)", (4,2)", "(6,3)", "(8,4)", "(3,5, "(1,6)", (7,7), "(5,8)'1 then your program should return the string true
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
