Question
Create the Grid Walker program in Java based in the following instructions. To start your program, ask the user for a number of rows and
Create the Grid Walker program in Java based in the following instructions.
To start your program, ask the user for a number of rows and columns. Then create a grid of the specified size. One space in the grid (at random) should have the letter T; each other space should have either U, D, L, or R at random. Display the contents of the grid.
Following that, ask the user for a starting row and column. Starting at that position, follow the directions indicated by the letter (up, down, left, or right) until one of three conditions occurs:
1) you go off the grid,
2) your path intersects itself, or
3) you reach the spot marked T.
Once one of those conditions occurs, specify which condition and print the grid with your path marked in stars. If you reached T, do not replace T with a * but do specify how many steps it took to reach T.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started