write C++ for following question., Computer Engineering

Assignment Help:
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 the
next 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
...
RowH
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.

Related Discussions:- write C++ for following question.

Work in standard view, Layout view is helpful for laying out Web pages. How...

Layout view is helpful for laying out Web pages. However you can adjust most of your design elements in Layout view, certain changes should be completed in Standard view. When you

Explain physical characteristics of magnetic disk, Q. Explain Physical Char...

Q. Explain Physical Characteristics of magnetic disk? Figure below lists main features that differentiate among different types of magnetic disks. First head may either be fixe

What are overlays, What are overlays? To enable a process to be larger ...

What are overlays? To enable a process to be larger than the amount of memory allocated to it, overlays are used. The idea of overlays is to keep in memory only those instructi

Explain single instruction and multiple data stream (simd), Normal 0 ...

Normal 0 false false false EN-US X-NONE X-NONE Figure: SIMD Organisation

Group cells in a layout table, Now you will put navigation button cells you...

Now you will put navigation button cells you just created into a single table. Grouping cells into a table enables you to control cell spacing and to easily move the cells as a gro

What is the use of system.data.dlinq.dll, System.Data.DLinq.dll gives funct...

System.Data.DLinq.dll gives functionality to work with LINQ to SQL.

Difference between a null pointer and a void pointer, A NULL pointer is a p...

A NULL pointer is a pointer of any type whose value is zero. A void pointer is a pointer to an object of an unknown type, and is guaranteed to have sufficient bits to hold a pointe

Why is green screen more popular for compositing, Question: (a) Explain...

Question: (a) Explain clearly, from pre-production to post production how you would carry out the scene with multi-camera. (b) What are the there main aspects that should be

Differentiate between static and dynamic memory, Differentiate between stat...

Differentiate between static and dynamic memory? The static RAM is simpler to use and has shorter read and write cycles. One of the main applications of static RAM is in execut

Write Your Message!

Captcha
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