Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Homework 1 Robot in Maze Could you solve this question using C++ please? Hand in hard copy of your code. Be prepared to run your

Homework 1 Robot in Maze

Could you solve this question using C++ please?

Hand in hard copy of your code. Be prepared to run your code in class. Begin this homework with your code for Lab 5.

Create a robot that moves through your 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 in the maze, the number of moves so far, and pause for a moment.

Here is an example display. X represents the robot:

++++++++++ E+ ++ +++ + + ++ +++++++ +X ++ +++++++ ++ +++ +++ ++ +E ++++++++++ ++++++++++

Move number 138

Your program should have three functions:

void createMaze( int &robotRow, int &robotColumn ) initialize maze and robot starting location

void showMaze( int robotRow, int robotColumn ) display maze and current robot location

bool robotMove( int &robotRow, int &robotColumn ) robot makes a random move In all three functions, robotRow and robotColumn are the position of the robot. Be sure to pass

robot position as parameters in the function call do no use global variables.

OPTIONAL (1 bonus point)

Make your robot smarter, so that it escapes the maze faster. For example, you can give your robot a memory. Ask the user to select dumb or smart robot before each run.

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

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions