If V is list of queen positions on an 8x8 chess board, write a program to determine how many pairs of attacking queens there are. A list of queen positions is a list or string of integers

computer science

Description

Q1. python 

(a) If V is list of queen positions on an 8x8 chess board, write a program to determine how many pairs of attacking queens there are. A list of queen positions is a list or string of integers between 0 and 7, e.g., 31046715, which means column 0 has a queen on row 3 and column 1 has a queen on row 1. (Any solution must have exactly 1 queen in each column, so this is an acceptable simplification). 


(b) Write a program for a beam search, that takes the beam size k as input, and that uses the heuristic developed in (a) to solve 8-queen problems. Make sure you have a termination condition, either successful (cost=0) or not (local cost minimum). 


(c) Generate a large number (100) of 8 queen problems (using random numbers), and solve them using your beam search for k=1, k=10 and k=50. Generate a graph that shows the number of solutions found for each value of k (average several runs for each k) and explain those results


Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.