Write cpp program that will implement a breadth-first search

Assignment Help C/C++ Programming
Reference no: EM131340419

Assignment

Write a C++ (or any other .net language) program that will implement a Breadth-First Search, a Depth-First Search, and an A* Search (using the number of misplaced tiles) to solve an 8-piece Slider Puzzle.

For this program, the above search strategies must be used to solve the 8-piece Slider Puzzle. The constraints of this project will be as they would be if the user were holding an actual, physical, version of the puzzle in their hand.

A tile cannot be removed from the environment

A tile cannot pass over or behind another tile

A tile can only be moved up, down, left or right (no diagonal moves)

A tile can only be moved into an empty space

The goal state of the puzzle should be:

1 | 2 | 3 |

4 | 5 | 6 |

7 | 8 | |

This program will need a simple menu for the user interface. This menu should include options for the user to generate a puzzle, run each of the searches against the generated puzzle, and an option to exit the program. The user interface should look something like this:

Welcome to the 8-piece Slider Solver

Please choose one of the following:

Generate a random puzzle

Run a Breadth First Search

Run a Depth First Search

Run an A* Search

Exit

Once a puzzle is generated, at least one of the searches must be run against it (the program should be able to do more than one sewrch per puzzle as well, however, this is not completely necessary). The user should choose the search. So, once a puzzle has been generated, the main menu should be called again to allow to the user to choose which search to run.

After the user chooses a search, the program should output the results. The program should keep track of what search was used, what the starting state of the puzzle was, whether a solution was found (SOME PUZZLES WILL HAVE NO SOLUTION! THE PROGRAM MUST BE ABLE TO IDENTIFY THIS AND OUTPUT THAT THE PROGRAM COULD FIND NO SOLUTION!), at what depth the solution was found, how many nodes were expanded to find the solution, and how long it took the program to find the solution. The program should then output the results of the search like so:

(Print Name of Search Used)

Staring State: (print starting state of the puzzle here)

Was a Solution found?: (print yes or no)

At what depth was the solution found?: (print depth)

How many nodes were expanded?: (print depth)

How long did the search take?: (print time)

Exit

Once the program has run a search against the generated puzzle, the program should return to the main menu so that the user can choose to generate a new puzzle, run another search on the puzzle that was already generated, or exit the program.

This program will need functions to accomplish the following (not all of these functions are necessary. Two or more can be combined into a single function. Some can be omitted entirely. These are just examples):

A function to create an interface menu for the user

A function to generate a randomized 8-piece puzzle and store it for use

A function to run a Breadth-First search

A function to run a Depth-First search

A function to run an A* search

A function to return the user to the menu after puzzle generation, error, or after running a search

A function to print the results of a search to the user (starting state, if a solution was found, depth of solution, how many nodes were expanded, time taken to finish)

A function to exit the program.

Reference no: EM131340419

Questions Cloud

What safeguards should be instituted to reduce the risk : ACCT20040 - Auditing and Ethical Practice and ACCT20075 - Auditing and Ethics Assessment Task. What action should Fellowes and Associates take to eliminate the potential threats to independence in situations (1) and (2) above? What safeguards shoul..
Negotiation gambits chart : As you prepare to write this week's discussion post, first review the article: How to Neutralise Aggressive Negotiators Tactics. Then, fill out the Negotiation Gambits Chart. Include the following information:
What is present value of this cash flow pattern : You have been offered the opportunity to invest in a project that will pay $5,640 per year at the end of years one through three and $11,382 per year at the end of years four and five . If the appropriate discount rate is 14.7 percent per year, what ..
Legislative influences on the labor relations process : Create a chart to compare and contrast the major legislative influences on the labor relations process. Your chart must contain at least five major legislative acts and how they affect management and unions. Columns should include the law, coverag..
Write cpp program that will implement a breadth-first search : Write a C++ (or any other .net language) program that will implement a Breadth-First Search, a Depth-First Search, and an A* Search (using the number of misplaced tiles) to solve an 8-piece Slider Puzzle.
Do you think my conclusion could be stronger : Do you think my conclusion could be stronger? Any tips or suggestions - discuss and critique the concluding paragraphs of at least two of your classmates.
Risk-free pure discount bond : Today is 01/01/02. On 06/30/03 we will have to make a payment of $100. We can only invest in a risk-free pure discount bond (nominal $100) that matures on 12/31/02 and in a risk-free coupon bond, nominal $100, that pays an annual coupon (on 12/31) of..
Compare confucian role ethics and care ethics : Your term paper will be on a topic of your choosing, so long as it is comparative in nature and addresses at least one of the major traditions of Asian philosophy discussed in this class. It will be worth a maximum of twenty points (the same as on..
Strategies marketers use to develop brand loyalty : How would you describe Apple's (or United Way) brand strategy? Discuss other brand strategies marketers use to develop brand loyalty. Give a detailed description of what in involved with the strategy--what are the various components?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Implement a function which finds the largest number

Write a function named largest which will receive the array as input and return the variable LargestNumber.

  Create a class called date that includes instance variable

Create a class called Date that includes 3 instance variables-a month (type int), a day (type int), and a year (type int). Provide a constructor that initializes the 3 instance variables and assumes the values provided are correct.

  Write the pseudo code for a subprogram called summer

Write the pseudo code for a subprogram called summer (and only the subprogram) which has three parameters: A two dimensional array of integers which is changed by summer and sent back

  Prepare an arbitrary sinusoidal waveform

Create a program to compute the derivative of an arbitrary input function, with arbitrary duration and arbitrary limits

  Write the equation of the perpendicular bisector

Write a program to read the point and slope information for two lines and to determine whether they intersect or are parallel. If they intersect, find the point of intersection and also determine whether they are perpendicular.

  You are the admissions office at abc medical university

You are the Admissions Office at ABC Medical University. You have a large number of applicants for a very few number of available openings at your school. As a result, you need to set some high admission standards. To be accepted, a student ..

  Function that returns the maximum value of the array

Arrays are collections of elements of the same type. The elements of the array can be accessed using their position (index) in the array.

  Feature for entreing information about a new train

Write a program in C++ to maintain the information for a Train station regarding the arrival and departure of trains in that station. Program should have the feature for entreing information about a new train arrived or departed at any point of ti..

  Positive integer value, and computes

Write a function in c++ that reads a positive integer value, and computes

  Prepare a program to get a number from the user

How will you prepare a program to get a number from the user and then demonstrate the output as the result above?

  Calculates the average of numbers

Write a C program which takes n number of element from user (where, n is specified by user), stores data in an array and calculates the average of those numbers. Output of the program should look like this;

  Write a program that creates a binary file by reading the

Write a program that creates a binary file by reading the data for the students from the terminal. The data of each student consist of roll no., name ( a string of 30 or lesser no. of characters ) and marks.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd