COP 3275 - Computer Programming Using C, Spring 2015 Project 3 Due date: Apr. 5th, 11:55:00 PM Instructor: Lin Qi [email protected] 1 Problem 1 - Eight Queen Puzzle (100 points) In this problem, you are expected to solve the eight queens puzzle. The puzzle is the problem of placing eight chess queens on an 8 × 8 chessboard so that no two queens threaten each other. (For those not familiar with chess pieces, the queen is able to attack any square on the same row, any square on the same column, and also any square on either of the diagonals). For example, Figure 1a is one example of a feasible solution to this problem. As you could see, that no two queens can attack each other. (b) Corresponding encoding representation (a) Graphical representation Figure 1: One example of a feasible solution to Eight Queen Puzzle Your task is to find one such solution and print it out. You should use 1 to represent the placement of a queen and use 0 for empty cells. The corresponding encoding representation of the previous example is shown in Figure 1b. Please note that the solution you have found does not need to be the one in the example as there are many distinct solutions to this problem. INPUT: No input required. OUTPUT: One feasible solution to this problem in the form of encoding representation (using 1’s and 0’s as in Figure 1b). Please note that there should be a space between each cell (0 or 1). 1
© Copyright 2024