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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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