A chess board is an 8x8 matrix on which chess pieces are placed. A real chess...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
A chess board is an 8x8 matrix on which chess pieces are placed. A real chess game has a variety of pieces that have different rules defining how each can move and whom they can attack. For example, the queen can attack any other piece on the same row, column, or diagonal. Your program is to find solutions to the "Eight Queens Problem". Place eight queens on a standard chess board such that no queen can attack another. There are 92 unique solutions! 2.2. Notes . . Turn in only your source file: QueensPuzzleSolver.java. It will have an inner class which defines your implementation of PuzzleTest. Make sure your class is not in a package (that is, it is in the default package). Your output must include your name. Not that you would ever look to cheat, but there are many other solutions to this problem online that do not use this approach. Please don't try to turn in one of those! Hint: What is your Universe? The Queen positions 1-8. Generate all possible combinations of these positions and test each one. Each candidate represents the position of that queen on that row. Therefore, you don't have to worry about queens attacking on rows and columns, that's handled by the nature of your solution. You just need to check diagonals. Determining whether two queens can attach on the diagonal is simpler than you may think. Look at some examples by hand and see if you can determine the simple mathematical relationship. 2.3. Required Main Class QueensPuzzleSolver . You must use the PuzzleSolve class and PuzzleTest interface to solve this problem. Your solution must be recursive. 2.4. Required Input Not applicable 2.5. Required Output Your output should look like the following: Eight-Queens Puzzle - Your Name Solution #1 Q . Q A chess board is an 8x8 matrix on which chess pieces are placed. A real chess game has a variety of pieces that have different rules defining how each can move and whom they can attack. For example, the queen can attack any other piece on the same row, column, or diagonal. Your program is to find solutions to the "Eight Queens Problem". Place eight queens on a standard chess board such that no queen can attack another. There are 92 unique solutions! 2.2. Notes . . Turn in only your source file: QueensPuzzleSolver.java. It will have an inner class which defines your implementation of PuzzleTest. Make sure your class is not in a package (that is, it is in the default package). Your output must include your name. Not that you would ever look to cheat, but there are many other solutions to this problem online that do not use this approach. Please don't try to turn in one of those! Hint: What is your Universe? The Queen positions 1-8. Generate all possible combinations of these positions and test each one. Each candidate represents the position of that queen on that row. Therefore, you don't have to worry about queens attacking on rows and columns, that's handled by the nature of your solution. You just need to check diagonals. Determining whether two queens can attach on the diagonal is simpler than you may think. Look at some examples by hand and see if you can determine the simple mathematical relationship. 2.3. Required Main Class QueensPuzzleSolver . You must use the PuzzleSolve class and PuzzleTest interface to solve this problem. Your solution must be recursive. 2.4. Required Input Not applicable 2.5. Required Output Your output should look like the following: Eight-Queens Puzzle - Your Name Solution #1 Q . Q
Expert Answer:
Answer rating: 100% (QA)
The Eight Queens Problem is a classic example of the NQueens problem where the task is to place N queens on an NN chessboard in such a way that no two queens threaten each other Queens can attack in t... View the full answer
Related Book For
Smith and Roberson Business Law
ISBN: 978-0538473637
15th Edition
Authors: Richard A. Mann, Barry S. Roberts
Posted Date:
Students also viewed these programming questions
-
c) 5. Use the p-value and the significance level to determine what conclusions should be made. Explain. a) P-value = 0.158, = 0.05 b) P-value = 0.0589, a = 0.01 P-value = 0.0289, a = 0.10 19 Detsb ng...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
Which of the below is the correct order of the consumption process? Question 2 options: Awareness; Thinking; Planning; Implementation/Action; Evaluation Evaluation; Thinking; Planning;...
-
The Matrix for a Markov chain is (A) Show that R = [.4 0 .6] and S = [0 1 0] are both stationary matrices for P. Explain why this does not contradict Theorem 1 A. (B) Find another stationary matrix...
-
Suppose that in addition to repairing your car, you can also spend money advertising. If you repair your car for H hours and buy A column inches of ads in the local paper, your benefit (the amount...
-
When costs are rising, which method reports higher net incomeLIFO or FIFO?
-
In what way could African slaves maintain a degree of control over their situation as salves and their being forced to live a foreign culture?
-
uestion 14 - of 14 Step 1 of 1 s part of a "green" initiative, California wants to apportion 150 e Hamilton method to determine how many of the vehicles s Student Enroll Campus En Los Angeles...
-
On June 12, 2002, Delta Corporation was awarded a $160,000 contract for testing a product. The contract consisted of $143,000 for labor and materials, and the remaining $17,000 was profit. The...
-
The concentration of schottky defect in ionic crystal is 1 in 10^10 at a temperature of 77C. Estimate the average separation in terms of the lattice spacing between the defect at 77C and calculate...
-
What considerations are involved in audit supervision?
-
What factors are relevant in determining the sufficiency of corroborating information?
-
Carol Warren, CPA, is performing an audit of the City of Ryan in accordance with generally accepted auditing standards. Required: a. Must Carol be concerned with the city's compliance with laws and...
-
Identify the two categories of evidential matter and indicate their relative importance to the third standard of field work.
-
What is the purpose of the third standard of field work?
-
Jeremy (unmarried) earned $101,900 in salary and $7,900 ininterest income during the year. Jeremy's employer withheld $10,000of federal income taxes from Jeremy's paychecks during the year.Jeremy h 2...
-
Use integration by parts to evaluate the following. Check your answer by taking the derivative. x2e-xdx
-
Civil Code 1719, subdivision (a) provides in part that any person who draws a check that is dishonored due to insufficient funds shall be liable to the payee for the amount owing upon the check and...
-
Civil Code 1719, subdivision (a) provides in part that any person who draws a check that is dishonored due to insufficient funds shall be liable to the payee for the amount owing upon the check and...
-
Identify and describe the principal kinds of equity securities.
-
SnoBoard Companys year-end balance in its Allowance for Doubtful Accounts is a credit of $440. By aging accounts receivable, it estimates that $6,142 is uncollectible. Prepare SnoBoards year-end...
-
Calculate the amount recorded as the cost of a new machine given the following payments related to its purchase: gross purchase price, $700,000; sales tax, $49,000; purchase discount taken, $21,000;...
-
Wecker Companys year-end unadjusted trial balance shows accounts receivable of $89,000, allowance for doubtful accounts of $500 (credit), and sales of $270,000. Uncollectibles are estimated to be...
Study smarter with the SolutionInn App