Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use nested for loops to loop through the blocked array. The outer index variable is the row, the inner index variable is the column. Read

Use nested for loops to loop through the blocked array. The outer index variable is the row, the inner index variable is the column.
Read the file one character at a time using the next() function (not nextline()).
Read in the
If the character is a 1, set the corresponding location in the blocked array to true.
If the character is a 0, set the corresponding location in the blocked array to false;
If the character is an S, set the location of the start and player, since the player starts at the starting location.
If the character is a G, set the location of the goal.
This would be a great place to use a switch statement, although you are not required to.
The tests for both constructors should pass now.
image text in transcribed

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

More Books

Students also viewed these Databases questions