Program that allows a user player to navigate a robot

Assignment Help Civil Engineering
Reference no: EM13849449

Write a program that allows a user (player) to navigate a robot through a maze from the start position at the bottom left of the maze, to the centre of the maze.

The Maze

The maze is constructed on a grid of 17 x 17 small squares. The maze given for this assignment is shown below, with row and column numbers. The robot starts in the bottom left corner (row 15, column 1). The robot must move vertically and horizontally along the black squares, until it reaches the square in the middle of the maze (row 8, column 8).

The row and column number system has been chosen to suit the drawing of the maze on the screen, from a two-dimensional array in the program.

The maze can be drawn from a console program using graphics characters, as shown above. A white square is ASCII character code 219, and a black square is a space character. The robot position is shown by R. The end position is shown by E. (On the computer screen, the "squares" appear as rectangles because the screen characters each occupy a rectangular shape.) If your own computer cannot display the graphics character (because you are using a different language from English, or using the Macintosh) then use the * character instead of the graphics character for a "white square".

The player can enter the commands U, R, D or L to move the robot up, right, down, or left to an adjacent black square. Also, the user can enter Q to quit the program.

The program must ensure the robot stays in the black squares. If a player command would cause the robot to go to a white square, the robot must not move. Diagonal moves are not possible. After each input, the program should display the maze image again, showing the new robot position graphically and as row and column coordinates (see the screen image above).

NOTE: The maze in the image on page 1 was used in a Micromouse competition where a robot is required to move to the middle of the maze, even though it does not know the maze layout. The robot has sensors that detect the presence of walls. The maze is designed so a robot cannot get to the middle by always staying next to either the left wall or the right wall as it moves through the maze.

For this assignment, the Micromouse maze has been modified so it requires at least one of each command (U, R, D, L) for the player to get the middle of the maze. Due to the limitations of using block graphics, the maze obstacles are solid blocks instead of walls. Also, the centre of the maze is a single square as this improves the suitability of the maze as a test for your program.

The maze layout is stored in the two-dimensional maze array given below. The row and column numbers given in the diagram on page 2 and on the screen image above are the same as the row and column numbers in the array. C++ code for the array definition is available with the assignment on AUTonline, in file Maze.cpp. Copy and paste this into your file.

Each number in the array represents the contents of the corresponding square in the maze.

- 1 means the square is blocked. This will show as a white square in the maze image.

- 0 means the square is not blocked so the robot can move to this square. This square will be black in the maze image.

The robot starts at row 15, column 1 and the user must move the robot to the square at the centre of the maze (row 8, column 8).

Program Structure

As part of this assignment, you must demonstrate that you can write and use your own functions.

You should have a small amount of code in the main function (in addition to the given maze definition) and write two other functions that you call from the main function:

- Display function that draws the maze on the computer screen as shown on page 2.

- Move function that inputs a robot command string and then moves the robot accordingly.

The main function should loop until the user types Q to quit or the robot reaches the centre of the maze.

Reference no: EM13849449

Questions Cloud

What were the major impacts of the huna invasions on india : What were the major impacts of the Huna invasions on India
Construct a pro forma income statement for the first year : Construct a pro forma income statement for the first year and second year for the assumptions - Price per unit increases to $11.50, and unit of sales increases by 5%, all other assumptions remain the same.
Sweeny todd the demon barber of fleet street : You must watch a theatrical video and write your paper on that viewing. The videos are located on "youtube" and is the musical is titled "Sweeny Todd The demon barber of fleet street." There are alot of videos on this musical; but there is one c..
Trial balance and a balance sheet : Write a 500-1,000-word essay describing the purpose of a trial balance and explain the difference between a trial balance and a balance sheet. Explain the concept of error-free trial balancing and how to correct errors in a trial balance.
Program that allows a user player to navigate a robot : Write a program that allows a user player to navigate a robot through a maze from the start position at the bottom left of the maze, to the centre of the maze.
Accounting for leases - why it matters : "The IASB believes that bringing operating leases (with the exception of short-term leases and small asset leases) on balance sheet will bring accountability and transparency and provide investors with complete information about a company's assets..
Case study of a criminal offender : Discuss the biological, developmental, and environmental factors that relate to the criminal behavior.
Identify the motivational factors that drive terrorism : Identify the motivational factors that drive terrorism.
Acquisition the shareholders funds : On June 30 2012 Alpha Ltd acquired all the shares in Beta Ltd for $1,440,000 cash. At the date of acquisition the shareholders funds of Beta Ltd were as follows:

Reviews

Write a Review

Civil Engineering Questions & Answers

  Calculate the total vertical stress pore water pressure

An investigation at a particular site reveald 10 m of clay overlying 2m of sand resting on bedrock.the water table was found to be at the ground surface and the piezometric level for the sand to be 2m above ground level

  Calculate the low point of the curve if the intersection at

A vertical parabolic curve is to be used as a sag curve, and it is desired to know the location and elevation of the low point. The curve is 750ft long , and the minus grade of 3.6 percent intersects the plus grade of 6.2 percent at station

  Alsogive the parameter rating in each of the fiveclasses

Giving the classes, explain how rocks are put intofive (5) classes by each of the above parameters. Alsogive the parameter rating in each of the fiveclasses. Hint; use a table to answer this question

  What will be the force in newtons required

A lunar module weights 1500 kg on earth where g = 9.75 mps2. On the surface of the moon where g = 1.70 mps2, what will be the force in Newtons required to accelerate the module at 10 mps2?

  Do the first three time increments by hand

A variable-order reaction A-->B has the following rate expression: R(a) = -kC(a)/(K+C(a)) where k = 5mg/L-hr and K=40mg/L The reaction is to take place in a batch reactor. The initial concentration is 450 mg/L

  Find yield strength for factor of safety of with deformation

During the manufacturing process, a circular steel bar of diameter20mm and length of 1.2m is subjected to an axial load P. Themodulus of elasticity of steel is 207 GPa. The steel bar mustacquire an elastic strain energy of 14J.

  Calculate the mean fragmentation size using kuz ram

The mine wants to change the hole diameter to 229 mm and needs a new drilling pattern that will not result in coarser fragmentation. For this exercise you can assume homogenous geology and no adverse effects due to geological structure.

  Determine m and b

The following points are taken from data that is known to be of the form y = bx^m

  You are a project manager on site where work for 3km long

you are a project manager on site where work for 3k.m. long tunnel has been undertaken. the site is remote and takes

  Determine what is the final river temperature downstream

A toothpaste factory situated on a large river disposes of a waste water containing villiamite (NaF) to the river on a continuous basis. The minimum flow in the river is 210 m3/s, and the discharge rate from the treatment plant is 12.5 m3/s.

  What is the concentration of bod in the jackson river before

The James Rives flows in from the East at 320 m^3/min and joins the Jackson River flowing at 605 m^3/min just outside the town of Charlotte, NC. The concentration of BOD in the James River is 14 mg/L

  Write expression for engineering strain associated with a

A piece of wire is stretched from length l1 to length l2 (step A), and then from length l2 to length l3 (step B). (i) Write down an expression for the engineering strain associated with step A.

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