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
-
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;...
-
(a) Sketch the electric field lines near a point charge + q. (b) Do the same for a point charge - 3.00q.
-
Let X and Y denote the lengths of life, in years, of two components in an electronic system. If the joint density function of these variables is find P(0 < X < 1 \Y = 2).
-
Specific speed of pump is: (a) \(\frac{N \sqrt{2}}{H^{3 / 4}}\) (b) \(\frac{N \sqrt{P}}{H^{5 / 4}}\) (c) \(\frac{N \sqrt{2}}{H^{2 / 3}}\) (d) \(\frac{N \sqrt{2}}{H^{3 / 2}}\)
-
Duke Distribution, Inc. recently had a public offering of its shares. The companys attorneys, its CPAs, and the underwriters attorneys worked diligently to meet a tight deadline that management had...
-
Write a program to check whether the given input is digit or lowercase character or upper case character or a special character (use 'if-else-if' ladder)
-
XYZ is a calendar-year corporation that began business on January 1, 2020. For the year, it reported the following information in its current-year audited income statement. Notes with important tax...
-
What is the concept of resonance, and how is it utilized in electrical and mechanical engineering, such as in designing circuits or tuning musical instruments?
-
13. Gabby's little sister plans to start her college education four years from now. To pay for her college education, she has decided to save $1,000 each quarter for the next four years in a bank...
-
Torres is still angry, years after an incident that he describes as "the most painful and shocking event" of his life. Growing up in Palo Alto, California, he and his friend Carlos had not...
-
Find the ethics rules in California related to one paralegal issue: billing, types of work permitted, confidentiality, or another issue. Identify one actual or potential ethical dilemma that might...
-
Given data below to solve these questions. 1. A. Initial investment: $125,000 Sound Cellar Pro Gamer Net Cash Cumulative Net Net Cash Cumulative Net Flow Cash Flows Flow Cash Flows Year 1 $ 65,000 $...
-
Ch: Statement of Cash Flows Use the financial statements for National Beverage Corp. to prepare the statement of cash flows using Indirect Method for the year ended Dec 29, 2019. Here are the 2019...
-
Make a written report comparing the governments, Laos, philippines and timor-leste. In your own opinion
-
Outline a general process applicable to most control situations. Using this, explain how you would develop a system to control home delivery staff at a local pizza shop.
-
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.
-
Meet local small business owners or representatives of as profit organizations. Find a company or organization that will host your team to produce a web site for them (nonmonetary, of course). Find...
-
More often than not, database environments in in organization reflect data structures that have been developed over a period of years, sometimes haphazardly, and that often reflect a variety of...
-
Although database systems have become the systems of choice for new and reengineered systems, are there any situations where a relational file-based system might be chosen instead? Explain your answer
Study smarter with the SolutionInn App