Create any additional data or functions you are suggested

Assignment Help Computer Engineering
Reference no: EM131845934

Assignment

Instructions

For this assignment, you need to implement two different search algorithms to solve a puzzle problem. For this puzzle game, the GUI (graphical user interface) framework is provided that is is developed by C++ and OpenCV library. The technical details are described in the source files of the project. Below is a highlight of the structure.

How to play:

After you run the project, you should be able to see a puzzle game coming out. You can use your mouse to select one piece of sub-image by one click and move it to the blank area by clicking the blank area. At any time, you can hit "s" key to search a solution, which you need to implement.

Classes Involved:

1.VisualDisplay- This class deals with all the graphical or visual stuff, including pattern generation from an image, user mouse/keyboard interface, ext (You do not need to modify this class).

2.RandomGenerator- This class is used to generate a random sequence of numbers (from 0-8), which are used as the orders of different pieces of an image that present different patterns. (You do not need to modify this class).

3.SolutionSearch- This is the class that provides a solution for a given puzzle. The solution can be found by different search algorithms. (You are required to implement the functions in this class).

Requirements:

You need to implement the two functions in the "SolutionSearch.cpp" file:

1. breadthSearch(int *data, vector &solution) (50%)
2. depthSearch(int *data, vector &solution) (50%).

What should be submitted:

You can put all your code inside the two functions "breathSearch()" and "depthSearch()". But if you want to create any additional data or functions, you are suggested to put all the created data or functions inside the "SolutionSearch" class, which are considered as the members of this class. So you just need to submit two files: "SolutionSearch.h" and "SolutionSearch.cpp" from the Isidore online system.

Explanation of A Search Function:

For each search function, there are two input parameters: the first parameter is the random order of the 9 numbers, which you need to re-organize to make them into the correct order; the second parameter is actually an output. It returns or stores the moving path of the "empty space" that it is involved to make all the sub-images in the correct position. The integer sequence variable "solution" should store all the steps along the "Optimal" path.

For example:

Input: data={0,4,1,3,8,2,6,7,5};
Goal: make it into the correct order {0, 1, 2, 3, 4, 5, 6, 7, 8}

You need to make the following changes on the number 8, since the number 8 represents the empty space, moving 8 to its neighboring numbers equals to moving the corresponding number to the empty space. Below it shows a demo of the steps:

0 4 1swap with 40 8 1swap with 10 1 8swap with 20 1 2swap with 50 1 2
3 8 2 -----------------> 3 4 2 -----------------> 3 4 2 -----------------> 3 4 8 ------------------> 3 4 5 --
----------> End
675 675 675 675 678

So from this example, the right path should be {1, 2, 5, 8}.

WHY? You may thought it was {4, 1, 2, 5}, since the number 8 has swapped with them in this order. That is true. However, we do not care which number it swapped with, but which position the number 8has gone through. As the numbers can be in any positions during different time, which give no hint about where the number 8 is. In contrast, the positions are fixed. So we assume the positions are in the same order as an increasing sequence:

[0] [1] [2] Fixed Position =[3] [4] [5] [6] [7] [8]

Here, I use "[]" to distinguish the positions from the numbers. So now you can see, the number 8 starts from position [4], then swapped with number 4, which goes to the position [1]; then swapped with number 1, which goes to the position [2]; then swapped with number 2, which goes to the position [5]; finally, swapped with number 5, which goes to the position [8]. So the path you should assign to the parameter "&solution" with the path sequence {1, 2, 5, 8}.

Reference no: EM131845934

Questions Cloud

Do the actuaries have the incentive to make a good decision : Who is making the bad decision? Do the actuaries have enough information to make a good decision?
What would the shareholders have to prove to prevail : If you were an outside director of Target, would you demand the resignation of the chief executive officer?
Are you a morning or an evening person : Are you a morning or an evening person? When did you first decide that you were one or the other?Has the fact that you are a morning or an evening
Project technology governance plan : Describe the governance framework of a organization will use to manage the oversight and use of IT (Information Technology)
Create any additional data or functions you are suggested : But if you want to create any additional data or functions, you are suggested to put all the created data or functions inside the SolutionSearch class.
What is the purpose of accounting : 1. What is the purpose of accounting? How might a management information system help you as an Accountant?
Provide the lowest transportation cost : Determine which location, South Coast Plaza (SCP), Fashion Island (FI), or Laguna Hills (LH), provides the lowest transportation cost.
Are the three main elements of compensation : Are the three main elements of compensation systems-internal consistency, market competiveness, and recognizing employee
Discuss the communication needs : For the primary stakeholders; sponsor, program manager and project team, discuss the communication needs, type(s) and rationale that you would include

Reviews

Write a Review

Computer Engineering Questions & Answers

  Design c++ program with 4 classes called a,b,c and d

Write down a C++ program with 4 classes called A,B,C and D. D should inherit C, C should inherit B and B should inherit A. All classes should have 1 data member of type int, 1 constructor and 1 function called print.

  Compute the greatest common divisor of two integers

Write down a recursive function that calculates the greatest common divisor of two integers using the Euclidean algorithm. Write a driver program to test your function.

  Implementing type parameterization in java

Do some investigation and explore whether C# requires that all objects be allocated from the heap and how it approaches type parameterization.

  You have been hired by tmi to design an application using

you have been hired by tmi to design an application using shell script programs. tmi case projects needs you to design

  Give a very small vb programing example of encapsulation

make a ""very small"" VB programing example of Encapsulation having two classes with a definition. Use VB code2003 to demonstrate. Please use new cars as this exapmle. Thanks, I need this by midnight.

  Why turning off computer by using power switch might harmful

Explain why turning off the computer by using the power switch might be harmful to the system. Four medical assistants work at their own computer workstations, which are networked to a server. Explain the function of the server.

  What is the total end-to-end delay to send a packet

The distance between host A and the switch is d1. The distance between the switch and host B is d2. Assuming that the propagation speed is s and the switch uses store-and-forward packet switching.

  Can a relation be stored as a sequential file

How various times should a user be allowed to mistype a password before the conversation is terminated.

  Discuss some methods to minimize the impact of budget cuts

Discuss some methods to minimize the impact of budget cuts when developing a training plan and how you will provide documentation support.

  Create databases to manage all audio video and photo data

Create small databases to manage all audio, video and photo data. Create and edit audio and video files and share video and audio files via emails, instant messaging, and in chat rooms via mobile devices.

  Providing overview of lane

Describe in scholarly detail an overview of the LANE and explain its place in an organization's network strategy. Answer should be of 300 words and also provide reference.

  How to use control flow to track membership

Using the Internet and other resources, discuss and study "control flow" in programming. How would you use control flow in computer programming to solve problems? Give an example of how you would use control flow to track membership dues in a smal..

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