Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Civil Engineering Expert

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.

Civil Engineering, Engineering

  • Category:- Civil Engineering
  • Reference No.:- M91419229
  • Price:- $80

Priced at Now at $80, Verified Solution

Have any Question?


Related Questions in Civil Engineering

Civilyou are provided with bill of quantities prepared

Civil You are provided with bill of quantities prepared separately, priced and submitted by 3 con- tractors (A,B,C found on LMS) in respect of a proposed project (see appendix for drawings). The site is located on Mt. Al ...

Task details the client is doing masters in civil

Task Details: The client is doing Masters in Civil Engineering. He needs a Technical Paper on Earthquake pertaining to Geology and Rock Mechanics. There should be a through discussion of Earthquake in relation to the men ...

The drainage system of a cantilever wall shown in below

The drainage system of a cantilever wall shown in below figure, became blocked after a heavy rainstorm and the groundwater level, which was originallybelow the base, rose to1.5 (m) below the surface. Determine the stabil ...

Aimthis assignment aims to demonstrate the structural

Aim: This assignment aims to demonstrate the structural design requirements of a glazed façade in a multi-storey building. Among other requirements, the glazed façade is required to comply with Australian Standard AS 204 ...

Assignment -ewb design report format - cover page - the as

Assignment - EWB Design Report Format - Cover page - The as EWB project Table of content Introduction about -EWB and CRDT (Cambodian Rural development team) Background about Cambodia - Economic, Weather, People - living ...

1 aimthe assignment aims to develop the ability to analyse

1. Aim The assignment aims to develop the ability to analyse, evaluate, research plan and manage a major building project through individual and group participation (ideally 4-6 people).Refer to vUWS for the DA plans and ...

Aimthis assignment aims to demonstrate the structural

Aim: This assignment aims to demonstrate the structural design requirements of a glazed façade in a multi-storey building. Among other requirements, the glazed façade is required to comply with Australian Standard AS 204 ...

Assignmenta continuous three spans beam with

Assignment A continuous three spans beam with centre-to-centre distance of 6 m supports 150 mm thick one-way slabs as shown below. The beams have clear spans of 8 m, 9 m, and 8 (face-to-face of 400 mm square columns). Th ...

Assessment taskpractical investigationinstructions- it is

Assessment Task Practical Investigation Instructions: - It is very important that you read these instructions. - The hardcopy of the Assignment report, with the Assignment cover sheet, should be submitted to the Assignme ...

Masonry design assignmentquestion 1 - derivation of seismic

MASONRY DESIGN ASSIGNMENT Question 1 - Derivation of seismic actions on building a) Determine the storey seismic weights (Wi) for each suspended level of the building, hence the seismic weight (Wt) of the entire building ...

  • 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