Presentation is loading. Please wait.

Presentation is loading. Please wait.

Back Tracking Project Due August 11, 1999 N-queens: –A classic puzzle for chess buffs is the N- Queens problem. Simply stated: is it possible to place.

Similar presentations


Presentation on theme: "Back Tracking Project Due August 11, 1999 N-queens: –A classic puzzle for chess buffs is the N- Queens problem. Simply stated: is it possible to place."— Presentation transcript:

1 Back Tracking Project Due August 11, 1999 N-queens: –A classic puzzle for chess buffs is the N- Queens problem. Simply stated: is it possible to place n queens on an empty nxn chess board so that no quen is “attacking” any other. This requires that no two queens are in the same row, or the same column, or along the same diagonal.

2 N-queens Example for n = 8 consider the following solution: Q Q Q Q Q Q Q Q

3 Program description Write a JAVA program which solves the n- queens problem using recursive backtracking. The user should enter the number n, which specifies the board size and the number of queens. Your program should output the solution if one exists, or a message saying indicating that no solution could be found (look at n=2).

4 Analysis Your program should give a measure of the run time required for a given solution (counting the number of calls to the recursive method). In your README file, plot the run time measure of your algorithm for various values of n and compare these values to a theoretical time based on analysis of your code.


Download ppt "Back Tracking Project Due August 11, 1999 N-queens: –A classic puzzle for chess buffs is the N- Queens problem. Simply stated: is it possible to place."

Similar presentations


Ads by Google