Menu

. Suzie in the Big City Suzie is a mouse in the big city. She needs to collect a lot of cheese that will last her throughout the cold winter months. Each day, Suzie travels to a new city to gather u…

Question

Answered step-by-step

Please see attachments for details

Image transcription text

Suzie in the Big City Suzie is a mouse in the big city. She needs to collect a lot of cheese that will last her
throughout the cold winter months. Each day, Suzie travels to a new city to gather up all the cheese
crumbs she can find. Cheese crumbs are gathered in boxes, so Suzie has to open each box toShow more
Show more

Image transcription text

Phase 1: The BigCity A city is defined by an MxN grid (M may not be equal to N). The city will show the
starting position of Suzie (denoted by 3 below). Suzie’s starting position is always at (0, 0). The city will
also show the boxes (denoted by ‘b’). Valid “paths” through the city are denoted by the ‘.’ charShow more
Show more

Image transcription text

A private method fillGrid() that: marks Suzie’s start position at (0, 0) with ‘s’ I marks the positions in
cheesePositions as ‘b’. – marks (numBoxes minus numCheese) random positions in the grid as ‘b’. It cannot
mark (0, 0) or any positions in cheesePositions. You can create a private method to do this. Show more
Show more

Image transcription text

cheesePositions = {{3, 1), 10, 3}} (the number of rows is always numCheese, the number of of columns is
always 2. Each row is the coordinates of a piece of cheese.) Given this sample input, you can tell that the
box at (3, 4) contains a trap for the grid shown above, as it is not in the list of cheesePositionsShow more
Show more

Image transcription text

To do this, add the following to your BigCity class: – Add a second constructor BigCity(String fileName).
This constructor reads the data in the text file specified by “fileNa me”. Do not forget to initialize your
instance variables. This method should throw an IOException with an appropriate message if tShow more
Show more

Image transcription text

Phase 3: Moving through BigCity Add the following to enable moving along the city grid. Create 2 count
variables: one to track how many cheese crumbs Suzie has collected, and one to track how many moves
Suzie has made moving through the grid. Do not forget to update both constructors to initialiShow more
Show more

Image transcription text

– A move onto a valid path (2′) increases the number of moves Suzie has made. – A move onto a ‘b’ can
either: — increase Suzie’s cheese collection by 1 (as well as her move count), or — end the game (and
increase her move count) by calling the endTerror() method you will implement in the next phaShow more
Show more

Image transcription text

. Suzie is caught by a trap in a box. To do this: Create method private void endTerrorU, that changes the
value of the variable indicating that Suzie is still roaming the city. Create a method boolean isRoamingCityt)
that tells the outside world if Suzie is still on the loose in the Big City! Update the processMoShow more
Show more

Image transcription text

Phase 6: Update the toString with Suzie’s stats! When Suzie’s reign of terror is done in a Big City, update
the output of your toString() method to include one of the following on a new line. Optionally watch out for
singular and plural tenses.
Show more

Image transcription text

Phase 7: Suzie’s Guardian Angel, Acqueline Suzie’s guardian angel, Acqueline, is always watching out for
her; she sees her every move and keeps track of them. Acqueline can only keep track of the last 5 moves
Suzie makes. This enables Suzie go back in time a maximum of 5 steps at once. To bring AcqShow more
Show more

Image transcription text

Now, create a method void undo(), which replaces the 2D grid instance with the 2D array at index 0 of this
partially filled array. If the partially-filled array is empty, it should do nothing. When this is done, element 0
of the partially-filled array is removed, and the remaining 2D arrays must shuffle left to fill the Show more
Show more

 

OR

Leave a Reply

Your email address will not be published. Required fields are marked *