Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please ATTn ready instruction before you post an answer. Use C++ and Run in visual studio please.... Thanks Hand in hard copy of your code.

Please ATTn ready instruction before you post an answer. Use C++ and Run in visual studio please.... Thanks

Hand in hard copy of your code. Be prepared to run your code in . Begin this project with your code for project 1 (the question is below this one)/..

Create a robot that moves through the maze. The robot makes random moves up, down, left, and right. It can only see locations that are directly adjacent to its current location. After each move, display the robot as an X in the maze, and press enter to make the next move. Here is an example display. The entrance is on the upper left and the exit is on the lower right: ********** * ** *** * * ** ******* * X ** ******* ** *** *** ** * ********** **********

Count the number of moves and, if the robot escapes the maze, display the total. Your program should have three functions: createMaze(char maze[][columns], int columns, int rows) initializes your maze showMaze(char maze[][columns], int columns, int rows) display maze and robot robot(char maze[][columns], int lastColumn, int lastRow, int &nextColumn, int &nextRow) robot makes a random move Be sure to pass maze and robot position as parameters in the function call do no use global variables.

also please do it: Make your robot smarter, so that it escapes the maze faster. For example, you can give your robot a memory.

- Maze please use c++ post copy of your code. Be prepared to run your code . Write a program that creates a 10 by 10 maze. Represent the maze as an array of characters, where * is a wall. Here is an example: char maze[10][10] = { {'*', '*', '*', '*', '*', '*', '*', '*', '*', '*' }, {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '*' }, {'*', '*', ' ', '*', '*', '*', ' ', '*', ' ', '*' }, {'*', '*', ' ', '*', '*', '*', '*', '*', '*', '*' }, {'*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '*', '*' }, {'*', '*', '*', '*', '*', '*', '*', ' ', '*', '*' }, {'*', '*', '*', ' ', '*', '*', '*', ' ', '*', '*' }, {'*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }, {'*', '*', '*', '*', '*', '*', '*', '*', '*', '*' }, {'*', '*', '*', '*', '*', '*', '*', '*', '*', '*' } }; Here is an example display. The entrance is on the upper left and the exit is on the lower right: ********** * ** *** * * ** ******* * ** ******* ** *** *** ** * ********** **********

the Code is here :::::::::::::::

#include

using namespace std;

int main(){

char maze[10][10] = { {'*', '*', '*', '*', '*', '*', '*', '*', '*', '*' }, {'*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }, {'*', '*', ' ', '*', '*', '*', ' ', '*', '*', ' ' }, {'*', '*', ' ', '*', '*', '*', '*', '*', '*', '*' }, {'*', ' ', '*', '*', ' ', ' ', ' ', ' ', ' ', ' ' }, {'*', '*', '*', '*', '*', '*', '*', ' ', '*', '*' }, {'*', '*', '*', ' ', '*', '*', '*', ' ', '*', '*' }, {'*', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }, {'*', '*', '*', '*', '*', '*', '*', '*', '*', '*' }, {'*', '*', '*', '*', '*', '*', '*', '*', '*', '*' } };

for(int i = 0; i<10; i++){ for (int j = 0; j<10; j++){ cout << maze[i][j] ; } cout << endl; }

return 0; }

please start from this code..

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

Students also viewed these Databases questions

Question

The correct answer is C . Please help me figure it out!

Answered: 1 week ago