Even complicated and confusing topics will be easily developed and covered if you request our help writing an essay. Place an order today!

Program Specification  

Overview

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. 

    // the maze design, 0 = maze space, 1 = maze block   

int maze[SIZE][SIZE] =  

    //  column number  

    //  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16  

    { { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, //  0 row  

      { 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1}, //  1 number  

      { 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}, //  2  

      { 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1}, //  3  

      { 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1}, //  4  

      { 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1}, //  5  

      { 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1}, //  6  

      { 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1}, //  7  

      { 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1}, //  8  

      { 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1}, //  9  

      { 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1}, // 10  

      { 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1}, // 11  

      { 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1}, // 12  

      { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, // 13  

      { 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1}, // 14  

      { 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1}, // 15     

{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}  // 16  

    };

 

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.   

Hints 

• Allow multiple moves per line as shown below. This is makes it easier to play and test the program. 

• Get each input line from the keyboard as a string using the getline function as follows:

  string input; 

 getline(cin, input);  

Then use a for loop using the input string length to make all the appropriate moves before the next display. In the display below, the actual moves have been displayed below the input, with indicating an invalid input character and the pipe symbol | indicating the move is blocked. 

 

• Your program should only 

 quit when Q is entered as the last character on the input line,

 end when the robot is at the end position after all the input line moves have been

made.

• Define the maze and robot position (row and column) variables in the main function and pass

them as parameters to the Display and Move functions. The Move function can change the robot row and column so these should be reference parameters in the Move function. The robot row and column should be value parameters in the Display function (because the Display function does not change the robot row or column).    

Assignment Requirements 

In this assignment you must demonstrate you can use the following programming techniques:

• use appropriate program comments 

• use a systematic program layout

• use only local variables

• use named constants (these may be global)

• use if statements 

• use appropriate loop statements

• write your own separate functions to display the maze image and to make a robot move 

 use function prototypes

• use function parameters and return values, including reference parameters 

• use a two dimensional array, including as a function parameter Do NOT use the following techniques: 

• do not use pointers or dynamic memory allocation or templates

• do not write your own classes

• do not use the break statement, except in a switch statement

• do not use the return statement, except at the end of a function

• do not use the continue or goto statements

• do not use the exit or system functions 

Assessment 

The assessment of your program will be based on the following points. This scheme may change a little, depending on the programs submitted. 

 STYLE (6)  DISPLAY FUNCTION (6)

1. Compiles without errors or warnings  9.  Function heading written correctly

2. Layout is appropriate (indenting, braces  10.  Displays the program title

 lined up, etc)  11.  Displays the maze correctly

3. Commented appropriately  12.  Displays row and column numbers

4. Constant definitions used appropriately  13.  Displays robot position and end

position 

5. Variable names and data types are  in the maze appropriate  14.  Displays robot

position as numbers 

6. Function prototypes are used  

   MOVE FUNCTION (6)

 MAIN FUNCTION (2)  15.  Function heading written correctly

7. Loops correctly  16.  Gets user input correctly 8. Calls functions correctly  17.  Handles all move commands correctly 

18. Handles quit command correctly

19. Handles invalid input values correctly 

20. Handles robot at centre correctly

 

 

 

testimonials icon
  1-Do you think it is important for nurses to be involved in their professional organizations? Why or why not?2. The Affor...
testimonials icon
FIND A SOLUTION AT All A+ Essays Write...
testimonials icon
Family Story My family comprises of five people; my beloved father, mother and two of my sisters. Mr. Griffins, my father is one of the...
testimonials icon
In this problem, how do they get answers e, f and g??The assets of Dallas & Associates consist entirely of...
testimonials icon
BUS 520 Strayer University Professional Development Program Proposal U...
testimonials icon
POS 408 Week 2 DQ 2...
testimonials icon
Order Grade A+ Academic Papers Instantly!...
testimonials icon
Identify a research or evidence-based article that focuses comprehensively on a specific intervention or new diagnostic tool for the treatment of...
testimonials icon
/*! elementor - v3.6.5 - 27-04-2022 */ .elementor-heading-title{padding:0;margin:0;line-height:1}.elementor-widget-heading .elementor-heading...
testimonials icon
Use single-spaced, 1” margins, Times New Roman, 12-point font with a maximum of 2 pages per assignment.• Do not overuse bullet poin...
testimonials icon
Discussion: Analyzing Organizational CultureA companys culture is often buried so deeply inside rituals assumptions attitudes and values tha...

Other samples, services and questions:

Calculate Price

When you use PaperHelp, you save one valuable — TIME

You can spend it for more important things than paper writing.

Approx. price
$65
Order a paper. Study better. Sleep tight. Calculate Price!
Created with Sketch.
Calculate Price
Approx. price
$65