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.

Slides:



Advertisements
Similar presentations
COSC2007 Data Structures II
Advertisements

Polynomial Time Algorithms for the N-Queen Problem Rok sosic and Jun Gu.
Solving N+k Queens Using Dancing Links Matthew A. Wolff Morehead State University May 19, 2006.
PROLOG 8 QUEENS PROBLEM.
Computers playing games. One-player games Puzzle: Place 8 queens on a chess board so that no two queens attack each other (i.e. on the same row, same.
 Chapter 7 introduces the stack data type.  Several example applications of stacks are given in that chapter.  This presentation shows another use called.
CPS 100, Fall Backtracking by image search.
Stacks CS 3358 – Data Structures. What is a stack? It is an ordered group of homogeneous items of elements. Elements are added to and removed from the.
Announcements Assignment #4 is due tonight. Last lab program is going to be assigned this Wednesday. ◦ A backtracking problem.
B ACKTRACK SEARCH ALGORITHM. B ACKTRACKING Suppose you have to make a series of decisions, among various choices, where You don’t have enough information.
P Chapter 6 introduces the stack data type. p Several example applications of stacks are given in that chapter. p This presentation shows another use called.
The N-Queens Problem lab01.
CompSci 100e Program Design and Analysis II March 3, 2011 Prof. Rodger CompSci 100e, Spring
Eight queens puzzle. The eight queens puzzle is the problem of placing eight chess queens on an 8×8 chessboard such that none of them are able to capture.
Backtracking COP Backtracking  Backtracking is a technique used to solve problems with a large search space, by systematically trying and eliminating.
Lecture 4 1) RECURSION 2)BACKTRACKING 3)LOOK AHEAD.
CSC212 Data Structure - Section FG Lecture 12 Stacks and Queues Instructor: Zhigang Zhu Department of Computer Science City College of New York.
Backtracking CSC 172 SPRING 2004 LECTURE 11. Reminders  Project 3 (mastermind) is due before Spring break  Friday, March 5 th 5PM  Computer Science.
Data Structures Using C++ 2E Chapter 6 Recursion.
Lecture 17: Spanning Trees Minimum Spanning Trees.
Vlad Furash & Steven Wine.  Problem surfaced in 1848 by chess player Max Bezzel as 8 queens (regulation board size)  Premise is to place N queens on.
Artificial Intelligence Lecture 9. Outline Search in State Space State Space Graphs Decision Trees Backtracking in Decision Trees.
Data Structures Using C++ 2E Chapter 6 Recursion.
Backtracking. N-Queens The object is to place queens on a chess board in such a way as no queen can capture another one in a single move –Recall that.
HISTORY The problem was originally proposed in 1848 by the chess player Max Bezzel, and over the years, many mathematicians, including Gauss have worked.
NxN Queens Problem Q- -- -Q Q- -- -Q Q- -- QQ -- Q- Q- Q- -Q QQ -- -Q -- -Q Q- -Q -Q Q- Q- -Q Q- -- Q- -- QQ Q- -Q -Q -Q -- QQ -- -Q START.
Solving N-Queens in Clojure
Two Dimensional Arrays
Data Structures Using C++ 2E1 Recursion and Backtracking: DFS Depth first search (a way to traverse a tree or graph) Backtracking can be regarded as a.
Please snarf the code for today’s class. Then think about the famous 8-Queen’s Puzzle. The question is: is there a way to arrange 8 queens on a (8x8) chessboard.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 5: Recursion as a Problem-Solving Technique Data Abstraction.
Two Dimensional Arrays. Two-dimensional Arrays Declaration: int matrix[4][11]; 4 x 11 rows columns
The "8 Queens" problem Consider the problem of trying to place 8 queens on a chess board such that no queen can attack another queen. What are the "choices"?
Data Structures Using Java1 Chapter 5 Recursion. Data Structures Using Java2 Chapter Objectives Learn about recursive definitions Explore the base case.
Algorithms April-May 2013 Dr. Youn-Hee Han The Project for the Establishing the Korea ㅡ Vietnam College of Technology in Bac Giang.
CompSci 100e 6.1 Plan for the week l More recursion examples l Backtracking  Exhaustive incremental search  When we a potential solution is invalid,
Backtracking & Brute Force Optimization Intro2CS – weeks
© 2006 Pearson Addison-Wesley. All rights reserved 6-1 Chapter 6 Recursion as a Problem- Solving Technique.
A Generalization of 3d Queens Adam Pendry Dr. Robinson May 2 nd 2012.
N- Queens Solution with Genetic Algorithm By Mohammad A. Ismael.
N-queens problem Original problem: How to place 8 queens on an 8x8 chessboard so that no two queens attack each other N-queen problem: Generalization for.
February 11, 2016Introduction to Artificial Intelligence Lecture 6: Search in State Spaces II 1 State-Space Graphs There are various methods for searching.
CPS Backtracking, Search, Heuristics l Many problems require an approach similar to solving a maze ä Certain mazes can be solved using the “right-hand”
An Analysis of the n- Queens problem Saleem Karamali.
INTRO2CS Tirgul 6. Understanding the Traceback # in file t.py: def a(L): return b(L) def b(L): return L.len() #should have been len(L) # in the python.
CSE 143 read: 12.5 Lecture 18: recursive backtracking.
Search Problems Russell and Norvig: Chapter 3, Sections 3.1 – 3.3 CS121 – Winter 2003.
Unit – 5: Backtracking For detail discussion, students are advised to refer the class discussion.
Data Structures & Algorithms Lecturer : Kritawan Siriboon, Room no. 913 Text : Data Structures & Algorithm Analysis in C, C++,… Mark Allen Weiss, Addison.
1 Tirgul 11: Recursion & Backtracking. 2 Elements of a recursive solution (Reminder) A base case that is so simple we need no computation to solve it.
 Chapter 7 introduces the stack data type.  Several example applications of stacks are given in that chapter.  This presentation shows another use called.
Using a Stack Chapter 6 introduces the stack data type.
CSSE 230 Day 25 Skip Lists.
Intro to Computer Science II
Data Structures and Algorithms
Sit-In Lab 1 Ob-CHESS-ion
The "8 Queens" problem Consider the problem of trying to place 8 queens on a chess board such that no queen can attack another queen. What are the "choices"?
Data Structures Using Java
1) RECURSION 2) BACKTRACKING 3) LOOK AHEAD
Using a Stack Chapter 6 introduces the stack data type.
Back Tracking.
Using a Stack Chapter 6 introduces the stack data type.
adapted from Recursive Backtracking by Mike Scott, UT Austin
Using a Stack Chapter 6 introduces the stack data type.
Using a Stack Chapter 6 introduces the stack data type.
CS Software Studio Assignment 1
Exercise: Dice roll sum
The N-Queens Problem Search The N-Queens Problem Most slides from Milos Hauskrecht.
The "8 Queens" problem Consider the problem of trying to place 8 queens on a chess board such that no queen can attack another queen. What are the "choices"?
Announcements Assignment #4 is due tonight. Last lab program is going to be assigned this Wednesday. ◦ A backtracking problem.
Presentation transcript:

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.

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

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).

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.