COM 1204 Assignment #6. Due: Wednesday, 29 May 2002 Working individually, you will design and implement a Java program that solves the following problem: Given a positive integer n, what is the smallest number of chess queens that can be placed on an n by n chessboard in such a way that no two queens can attack another, but every square of the board is either occupied by a queen or under attack by at least one queen? In addition, your program will generate a display that shows how the minimal number of queens can be placed to achieve this objective. Your program should be capable of working for any positive integral value of n, up to and including the largest integer that can be represented as a Java int. Your program should solve the problem quickly when n is a small integer such as 8; this implies, for example, that your program cannot simply generate all 2^n placements of queens on an n by n chessboard and test these placements to see which ones solve the problem. Collaboration between students is forbidden on this assignment. You are responsible for keeping your code hidden from all other students. Your grade will be determined by these factors: how well you hide your code from others how well you follow instructions for submitting your code correctness of your program efficiency of your program readability and clarity of your program (e.g. indentation, formatting, comments, simplicity) Turn in your work on this assignment before 4 pm on the due date by sending each of the Java files in your program in a separate electronic mail to will@ccs.neu.edu The subject of each message must be COM 1204 assignment #6: followed by a space and the name of the file whose contents are the body of that message. For example, the message that submits your QueenSolver.java file should have COM 1204 assignment #6: QueenSolver.java as its subject. The body of each email must consist of nothing but the Java code for the file named in the subject. That file must begin with a Java block comment that lists 1. Your name. 2. Any remarks that you wish to make to the instructor. Late assignments may be discounted, and very late assignments may be discarded. Your email must be sent as plain text, with no MIME or HTML encoding, and must not include any signature lines or other stray characters that would prevent your code from compiling and running. Furthermore your code should follow the other guidelines announced in class. -------------------------------------------------- The instructor is providing the textbook's code for the 8 queens problem in /course/com1204/.www/will/Assignments/A6. This code is being provided to show you one way to draw a graphics window that displays queens on a chessboard. Your program must contain a file named QueenSolver.java that declares a public class QueenSolver that contains a public static void main (String) method. Your program will be called with one command-line argument n, an integer, as in % java QueenSolver 8 Your program must print, to System.out, the minimum number of queens required to occupy or to attack every square of an n by n chessboard, without any pair of queens attacking each other. Your program must then show how to accomplish that goal using that many queens on an n by n chessboard. This display must work for all n < 10, but the display part of your program is not required to work well for large values of n.