How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Mr. Gregory White Your Own Question

Mr. Gregory White
Mr. Gregory White, Professor
Category: Homework
Satisfied Customers: 5229
Experience:  M.A., M.S. Education / Educational Administration
46856550
Type Your Homework Question Here...
Mr. Gregory White is online now
A new question is answered every 9 seconds

DTU Tunnel Runner Beneath DTU is a vast network of tunnels

Customer Question

DTU Tunnel Runner Beneath DTU is a vast network of tunnels interconnecting most buildings on campus. The origin and true extent of this network remains unknown and many theories have been put forward to explain its purpose. In this assignment you will
write programs that navigate the tunnel system in order to achieve certain goals. You should start by solving Exercise 2.1 as the remaining exercises depend on it. Exercise 2.2-2.5 can be solved independently, but it is recommended that you proceed in order
and try to make use of your previous solutions. A few hints are provided of how to do this. It is not expected that your solutions are the most algorithmically efficient – but for an extra challenge, feel free to improve your algorithms after you are confident
they are correct. To get started, download the file tunnelrunner.zip found with this assignment on CampusNet. In it you will find the file TunnelMap.java, which is the only file you should modify in order to solve the following exercises. This is also the
only piece of source code you need to upload to CodeJudge and hand in with your report on CampusNet. TunnelMap relies on the class Position, which is used for representing a (row,column) position in the map. This class can also be found in tunnelrunner.zip.
In addition tunnelrunner.zip contains a number of other files and classes that implement a graphical interface that can visualize tunnel maps and routes. You do not need these files for solving the exercises, but you might find them helpful in debugging your
solutions. To try out the interface you can run the main method in the class TunnelRunner, which should display a simple test map on your screen. The file README.txt in tunnelrunner.zip contains more details about these files and how to set up the project
in Eclipse. Reading tunnel map files Allegedly the tunnel system reconfigures itself every night, so your program must be able to read different tunnel maps. A tunnel map is a grid consisting of n ≥ 1 rows and m ≥ 1 columns. Tunnel maps are specified in text
files having the following format: Tunnel Map File Format The first line is an integer n ≥ 1 specifying the number of rows in the grid. The second line is an integer m ≥ 1 specifying the number of columns in the grid. The third line is an integer g ≥ 0 specifying
the number of ghosts in the grid. The fourth line is an integer z ≥ 0 specifying the number of zombies in the map. Line 5 to 5 + n − 1 (both inclusive) each consists of exactly m symbols specifying the map data. Each symbol is either “#” (denoting a wall),
a space “ ” (denoting an empty part of the tunnel system), “G” (denoting a ghost) or “Z” (denoting a zombie). See Figure 1a for an example of a valid map file. Exercise 1: Implement the following method in the TunnelMap class. public void loadMap(String fileName)
The method reads a tunnel map from the file fileName into the tunnel map object. The method stores the data from the map file in the following fields: int rows, int cols, char[][] mapData, Position[] ghosts and Position[] zombies. For details on what these
fields store, see the comments in the TunnelMap class. The method prints “Map loading error” to the console and does not modify the state of the object if the file does not have the right format or any other exception occurs. https://gyazo.com/fd63aaa31da7…
Figure 1: Example of a valid tunnel map file (lines numbers on the left), the corresponding map, and the distance map for position (4,1). Hint: Check that your code works correctly when the file format is invalid.
Submitted: 1 year ago.
Category: Homework
Customer: replied 1 year ago.
The format came out weird this should be better:
------
DTU Tunnel RunnerBeneath DTU is a vast network of tunnels interconnecting most buildings on campus.
The origin and true extent of this network remains unknown and many theories have
been put forward to explain its purpose. In this assignment you will write programs
that navigate the tunnel system in order to achieve certain goals. You should start by
solving Exercise 2.1 as the remaining exercises depend on it. Exercise 2.2-2.5 can be
solved independently, but it is recommended that you proceed in order and try to make
use of your previous solutions. A few hints are provided of how to do this. It is not
expected that your solutions are the most algorithmically efficient – but for an extra
challenge, feel free to improve your algorithms after you are confident they are correct.
To get started, download the file tunnelrunner.zip found with this assignment on
CampusNet. In it you will find the file TunnelMap.java, which is the only file you should
modify in order to solve the following exercises. This is also the only piece of source code
you need to upload to CodeJudge and hand in with your report on CampusNet.
TunnelMap relies on the class Position, which is used for representing a (row,column)
position in the map. This class can also be found in tunnelrunner.zip.
In addition tunnelrunner.zip contains a number of other files and classes that implement
a graphical interface that can visualize tunnel maps and routes. You do not need these
files for solving the exercises, but you might find them helpful in debugging your
solutions. To try out the interface you can run the main method in the class
TunnelRunner, which should display a simple test map on your screen. The file
README.txt in tunnelrunner.zip contains more details about these files and how to set
up the project in Eclipse.Reading tunnel map files
Allegedly the tunnel system reconfigures itself every night, so your program must be
able to read different tunnel maps. A tunnel map is a grid consisting of n ≥ 1 rows and
m ≥ 1 columns. Tunnel maps are specified in text files having the following format:
Tunnel Map File Format
The first line is an integer n ≥ 1 specifying the number of rows in the grid.
The second line is an integer m ≥ 1 specifying the number of columns in the grid.
The third line is an integer g ≥ 0 specifying the number of ghosts in the grid.
The fourth line is an integer z ≥ 0 specifying the number of zombies in the map.
Line 5 to 5 + n − 1 (both inclusive) each consists of exactly m symbols specifying
the map data. Each symbol is either “#” (denoting a wall), a space “ ” (denoting an
empty part of the tunnel system), “G” (denoting a ghost) or “Z” (denoting a zombie).
See Figure 1a for an example of a valid map file.Exercise 1:
Implement the following method in the TunnelMap class.
public void loadMap(String fileName)
The method reads a tunnel map from the file fileName into the tunnel map object. The
method stores the data from the map file in the following fields: int rows, int cols, char[][]
mapData, Position[] ghosts and Position[] zombies. For details on what these fields store,
see the comments in the TunnelMap class. The method prints “Map loading error” to the
console and does not modify the state of the object if the file does not have the right
format or any other exception occurs.
https://gyazo.com/fd63aaa31da7…
Figure 1: Example of a valid tunnel map file (lines numbers on the left), the
corresponding map, and the distance map for position (4,1).
Hint: Check that your code works correctly when the file format is invalid.
Expert:  Mr. Gregory White replied 1 year ago.
THIS ANSWER IS LOCKED!

You need to spend $3 to view this post. Add Funds to your account and buy credits.