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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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