Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions