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

  Write down a java application that reads from a text file

give exception handling for opening and reading from the input file. Also, provide exception handling for checking the input file format. Your program must explain to the user the reason for each exception and terminate if one is thrown.

  How to consider changing the hibernate framework

This Application challenges you to evaluate connectivity issues between database management systems (DBMS) and the procedural programming languages.

  Authenticating the evidence

You will offer the POC additionally as a matter of procedure the known facts of incident and what are the procedures were utilized during the initial case reviews. Identification of any collection requirements for attaining and authenticating the ..

  A variety of both technical and business skill sets

An effective project manager wants a variety of both technical and business skill sets. recognize the nontechnical skills that have been associated with superior project management.

  Cross-validation and percentage split

Comparing the accuracies received utilizing the three "test options": "Utilize the training set", "cross-validation" and "percentage split".

  Difference between clustered and nonclustered indexes

define the meaning of each of the transaction levels supported by SQL Server.

  Write down the names of five currencies

Write down a C program that displays a title, "Currency Conversion," and then write the names of five currencies and their equivalents to the US dollar. The conversions are hard coded equations.

  Propose a wiring plan for network servers

Propose a wiring plan for network servers.

  Describe stages of the processor

Describe the decode stage and Describe the execution stage of add, andi, mul, divi, and neg.

  Describes a function named insidecircle

Describes a function named insideCircle

  Entity-relationship diagrams

The process of starting with the world objects and modelling utilizing the entity-relationship diagrams is known to as a top-down process.

  Give the average frame replacements for each

you would create a program that automatically generates numbers between a range provided by the user and stores them in an array. Your program will then calculate the number of page faults using replacement algorithms and provide the average frame..

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