Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

For this assignment you will use the robot/maze simulation example introduced in mini-assignments 0625ma-0627ma to develop a maze-solving program. The program will read a file containing the maze configuration and the robot's starting position, as in the mini-assignments. The robot should then explore the maze using a "right-hand-on-the-wall" strategy. As the robot traverses the maze, the robot's action at each intersection or dead-end (go straight, turn left, turn right, or u-turn) should be recorded in a linked list. The "right-hand-on-the wall" strategy will guarantee that the robot will eventually successfully complete the maze. However, the robot's path may contain many extra turns and backtracks as it explores the maze. The program should use the curses library to display an animation of the robot's travel through the maze. In addition, after completing the maze the program should display "turn-by-turn" instructions for the route followed, using the information stored in the linked list. Once the maze has been solved, the program should process the linked list of recorded turns to determine the optimal path through the maze using the path- optimization process. The robot will then re- traverse the maze using the optimized path. The program should print the optimized turn-by-turn instructions and display a curses animation of the robot traversing the maze via the optimized path. Conceptually, the maze should be considered as black lines drawn on a white background. In actuality, the maze will be represented in your program as a grid, each element of which has either the value 0 (representing white) or 255 (representing black). The maze configuration is read from a supplied text file. The first two lines of the file indicate the number or rows and columns, respectively in the maze. The remainder of the file specifies the value for each element of the maze, in by-row order. The code for reading the maze information from the file and storing it into a Maze structure is provided for you, as in the earlier mini- assignments. A robot model is also provided as in the earlier mini-assignments. The following functions for moving the robot on the maze are provided in robotModel.c: moveStraight(), moveLeft(), moveRight(), uTurn(), and moveHere().

The robot is assumed to have four sensors, which sense the color (black or white) of the maze grid at the following locations: directly in front of the robot, directly to the left of the robot, directly under the robot, and directly to the right of the robot. The sensor readings can be obtained by calls to four supplied functions: blackInFront(), blackToLeft(), onBlack(), and blackToRight(). See the file maze.c for the definitions of these functions. You can assume that the robot will be initially positioned on a maze line. The end of the maze will be represented by a "black area" large enough that all sensors will read "black" for two consecutive time steps. Additional information on how to use the sensors to determine the configuration of intersections and other maze features. As your robot traverses the maze (both before and after path optimization), your program should use curses to show an animated display of the robot's progress. A function printMazePlusCurrentPos() is provided in maze.c to assist you with this. You can control the robot's movement speed by using the curses napms() function. For instance, to cause your program to delay for one second before advancing the robot to its next position, you can use the statement:

napms(1000); //sleep for 1000 ms before continuing to next statement

The supplied directory homework/hw4 contains the curses library, along with header and C-program files containing functions for the robot and maze models. The directory also contains a partially completed main program, hw4.c, that you will need to edit to complete the assignment. The directory contains two maze definition files, maze.text and mazeLarge.txt. As inferred from the file names, the maze defined by mazeLarge.txt is much larger that the one defined by maze.txt. Remember that the name of the maze file must be supplied as a command line argument when the program is run. Code::Blocks project files are also provided for both Linux and Windows. Consult the lecture slides for June 25-27 for instructions on how to compile and run the code using either Code::Blocks or the command line.

Required Programs:

1. Program successfully solves provided maze using "right-hand-on-the-wall" strategy.

2. Program correctly maintains "turn information" in a linked list and correctly prints out "turn-by-turn" instructions for route followed in original maze traversal.

3. Program correctly optimizes the turn list to compute optimal route and correctly prints out the optimized turn-by-turn instructions.

4. Program correctly displays curses animation of robot solving maze via optimal route.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M9522656

Have any Question?


Related Questions in Programming Language

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

Extend the adworks applicationi add dialogs to allow the

Extend the AdWorks application I. Add Dialogs to allow the user to Add, Edit, Read and Delete a Customer and refresh the view accordingly. 1. The user should be able to select a specific customer from the DataGrid and cl ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Php amp session managment assignment -this assignment looks

PHP & SESSION MANAGMENT ASSIGNMENT - This assignment looks at using PHP for creating cookies and session management. Class Exercise - Web Project: Member Registration/Login This exercise will cover adding data connectivi ...

Overviewthis tasks provides you an opportunity to get

Overview This tasks provides you an opportunity to get feedback on your Learning Summary Report. The Learning Summary Report outlines how the work you have completed demonstrates that you have met all of the unit's learn ...

Task - hand execution of arraysoverviewin this task you

Task - Hand Execution of Arrays Overview In this task you will demonstrate how arrays work by hand executing a number of small code snippets. Instructions Watch the Hand Execution with Arrays video, this shows how to ste ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As