A mad man has locked you in a maze with only one exit. You need to escape the maze as quickly as possible. Thankfully you have the map of the maze, but you notice strange markings with each room; you discover that each room has special effects. Write a program to find the quickest path out of the maze. Input will be from a text file where the first line contains an integer, N, the number of cases. For

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

A mad man has locked you in a maze with only one exit. You need to escape the maze as quickly as possible. Thankfully you have the map of the maze, but you notice strange markings with each room; you discover that each room has special effects. Write a program to find the quickest path out of the maze. Input will be from a text file where the first line contains an integer, N, the number of cases. For

 
 
 
 
 
 
 
Updated August 29, 2021 COSC 2436 F215 each case, the first line will consist of 2 integers, which indicate the number of rows and columns of the map, respectively. The map will consist of the characters: X, S, A, F, G, L, N, and O. The characters represent specific effects that each room has:•"S": The room marked S is the starting room. •"X": The room marked X is the ending room.•"A": In rooms marked A, you can enter through any direction and leave through any direction. It takes 10 seconds to pass through room A.•"F": It takes 20 seconds to pass through rooms marked F. Otherwise it functions like an A room.•"G": You must move left when you walk through rooms marked G. A room marked G will never appear on the left-most column of the map. You may enter through any side, and it takes 10 seconds to pass through these rooms.•"L": You must leave the room in the direction opposite from the one you entered from. (i.e., if you enter a L room from the right side, you must leave from the left side) It takes zero seconds to pass through these rooms.•"N": Rooms marked N are unpassable.•"O": Rooms marked O function like the whatever room is to the left of them. A room marked O will never appear on the left-most column of the map or to the right of the S or X rooms.Output to the screen, with each case labeled, the shortest amount of time it takes to get from room S to room X. Your answer should be in integer form. Let the user input the file name from the keyboard. Refer to the sample output below.Sample File: Sample Run: 22 8 SLOOOOOX NNNNNNNN5 8 AFGNOFFAFSFOOLGGALNNNGGGAGONALLAALOXANN
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY