Calculate minimum distance from the start to the goal

Assignment Help Computer Engineering
Reference no: EM13264789

We are planning an orienteering game. The aim of this game is to arrive at the goal (G) from the start (S) with the shortest distance.

However, the players have to pass all the checkpoints on the map.

An orienteering map is to be given in the following format. ######## #@....G# ##.##@## #[email protected]# #@.....# ######## In this problem, an orienteering map is to be given.

Calculate the minimum distance from the start to the goal with passing all the checkpoints -Specification * A map consists of 5 characters as following.

You can assume that the map does not contain any invalid characters and the map has exactly one start symbol ''S'' and exactly one goal symbol ''G''. * ''S'' means the orienteering start. * ''G'' means the orienteering goal. * ''@'' means an orienteering checkpoint. * ''.'' means an opened-block that players can pass. * ''#'' means a closed-block that players cannot pass. * It is allowed to move only by one step vertically or horizontally (up, down, left, or right) to thenext block.Other types of movements, such as moving diagonally (left up, right up, left down and right down)and skipping one or more blocks, are NOT permitted. * You MUST NOT get out of the map. * Distance is to be defined as the number of movements to the different blocks. * You CAN pass opened-blocks, checkpoints, the start, and the goal more than once if necessary * You can assume that parameters satisfy following conditions. * 1 <= width <= 100 * 1 <= height <= 100 * The maximum number of checkpoints is 18. * Return -1 if given arguments do not satisfy specifications, or players cannot arrive at the goal from the start by passing all the checkpoints.

Input: The input is to be given in the following format, from the standard input. W H Row1 Row2 ... Row The first row is to describe the width and the height of the orienteering map, sectioned by a space.

From the second row, map information is to be given for exactly the same number of rows as the height.

Each row contains exactly the same number of letters as the width.See "Specification" for details of the symbols contained in the map. Output: Output into the standard output, and put a return.

Reference no: EM13264789

Questions Cloud

Explain the fingerprint region of the ir spectrum : In the fingerprint region of the IR spectrum, what do the absorptions at 746 and 688 cm-1 tell you about the substitution pattern of this compound
How big will be torque on shaft of motor is efficiency : mutual shifted by 90 degree currents through each of both windings of the single phase A motor are (5.5+1.7) A but RMS voltage of the supply is 220 V. How big will be torque on shaft of the motor is efficiency factor (\eta\) is 0.7
Which break-even sales level is usually lower : For the same project, which break-even sales level is usually lower, the net present value breakeven or the income breakeven? Pick one
What is a black swan event : What is a Black Swan event? Does it ever make sense a priori to devote resources to preventing a black swan event?  Explain. Does it ever make sense a priori to devote resources to containing a black swan event should one occur?  Explain.
Calculate minimum distance from the start to the goal : Calculate the minimum distance from the start to the goal with passing all the checkpoints -Specification - The aim of this game is to arrive at the goal (G) from the start (S) with the shortest distance.
Compute the concentration of iron chloride contaminant : Calculate the concentration of iron (II) chloride contaminant in the original groundwater sample. Round your answer to significant digits.
How much noise should we expect at output of the amplifier : if we have an amplifier whose spec. is 2nV/rtHz and the bandwidth of the amplifier extends from 100Hz to 10kHz, and the gain of the amplifier is 5, how much noise should we expect at the output of the amplifier
Explain how many milligrams of digitalis should a 180 lb : At a dosage of 18 micrograms/kilograms body weight, how many milligrams of digitalis should a 180 lb. patient receivec
Favorite advertising subjects is subliminal advertising : One of my favorite advertising subjects is subliminal advertising. What do you think? Is it going on and we don't know it? Describe how you think subliminal perception could be used by marketers to the detriment of us consumers

Reviews

Write a Review

Computer Engineering Questions & Answers

  Average access time of memory system

The access time to cache is 30 nanoseconds. The access time to memory is 120 nanoseconds. The data bus between cache and main memory is 128 bits wide. The hit rate on cache is 95%. 25% of the cache blocks are dirty.Specify the average access time o..

  Dicsuss the business scenario that may call

express a business scenario that might call for an index-organized table.

  Preventing the pci specifications

To prevent having the whole network subject to the PCI specifications, how would you segment the network in order to decrease the scope of compliance?

  Explain the right action to take in a particular situation

According to virtue ethics, the right action to take in a particular situation is the action that a person with a strong moral character would take. If you decide to practice virtue ethics, you require to find a moral role model. How would you cho..

  Generating an array for a particular structure

You should generate a structure student_t in order to store the student name and three exam scores. You will generate an array of this structure in the main function.

  How to an edited version of the same text to another file

create a program that reads text from one file and writes an edited version of the same text to another file.

  Write a process findranks in java

Write down a method findRanks in Java that accepts an unsorted array of integers vals, and a starting and ending rank start and end, numbering ranks from 0, and returns an unsorted (any order is acceptable) array containing the lo-th through the h..

  Engineer using an automated monitoring system

auto mechanic with an automatic diagnostic system.a train engineer using an automated monitoring system.

  What are the challenges in rolling out a business

What is "enterprise-wide analytics technology," and how can it play a part in understand business processes? What are the challenges in rolling out a Business Intelligence tool.

  Find out another design pattern for web based development

There are other design patterns that could be directly applicable to PHP programming, or web programming in general.

  Concept of software integration

Explain how hospitals, manufacturing, retailing, education, construction, agribusiness, and shipping are improving efforts with their supply chain through the evolution of software.

  Distributed information systems

Complete the partial code provided with this lab that implements a simple group communication application using Java's MulticastSocket class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd