Question: I'm working on a chess program in Common LISP that calculates the best placement of two chess queens on a n by n sized chess
I'm working on a chess program in Common LISP that calculates the best placement of two chess queens on a n by n sized chess board so that the coverage of the 2 queens are either minimized or maximized (up to the user)
Create a function that takes in the positions of the two queens as two squares (ex. ((1,1) (0,0)) and takes in n (ex. (3 (1 , 1) (0 , 0)) where n = 3 (the size of the chess board, a 3 x 3) and returns the number of squares covered by the 2 queens.
It is helpful to have an intersect function that takes in two squares and returns true if the two squares are on the same column, same row, or same diagonal (there are two diagonals for any square). The easiest way is to check every possible square and see if it intersects with either of the queen squares.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
