Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ or Java programming question (Please help if you can) Simulation of two people wandering trying to find each other 1. Prompt the user to

C++ or Java programming question (Please help if you can)

Simulation of two people wandering trying to find each other

1. Prompt the user to enter map coordinates A units wide and B units tall (2 <= A <=50, and 2 <= B <= 50) (the coordinates may not be the same) that will then create a rectangular map that the two characters will navigate through. One character starts in the upper left hand corner and the other starts in the lower right hand corner. The characters try to move from one cell in the grid to another cell in the grid simultaneously. Time units are integers; time starts at 0 and is incremented by one at each time step. At each time unit, each person tries to move one unit by randomly choosing one direction ( most likely through a random number generator) , either North, South, East, West, Northeast, Northwest, Southeast, or Southwest. The grid is surrounded on all four sides by the impossible barrier. So, if the randomly selected direction takes the person into the barrier, they just stay at the same place they were at the start of that time unit. For example, since character 1 starts in the upper left corner of the grid, if character 1 randomly decides to go North, West, Northwest, Southwest, or Northeast, then character 1 will not move out of the upper left corner on that turn. However, if character 1 randomly decides to go any of the other three directions, then character 1 will actually move to a new cell. Simulate the random moves of the two characters until they either end up in the same cell (stop program) or do not meet after 1,000,000 time units (stop program)

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_2

Step: 3

blur-text-image_3

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

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

More Books

Students also viewed these Databases questions

Question

a. How do you think these stereotypes developed?

Answered: 1 week ago

Question

7. Describe phases of multicultural identity development.

Answered: 1 week ago