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.

What is macro, A series of keystrokes and mouse clicks that can be abbrevia...

A series of keystrokes and mouse clicks that can be abbreviated into a one keystroke or mouse click.

Meaning of all variable, A project having of a set of jobs and a set of pre...

A project having of a set of jobs and a set of precedences, where precedence (i; j) show that job j cannot begin before job i is completed. Let c i be the duration of job i. We wi

Define mapping and list mapping procedure, Define Mapping and List  mappin...

Define Mapping and List  mapping procedure? The transformation of data from main memory to cache memory is known as an Mapping. Associative mapping Direct mapping

Define process, Define Process Process is a program in execution; proc...

Define Process Process is a program in execution; process execution should progress in sequential fashion. A process involves: a) Program counter  b) Stack c) Data se

How branching takes place in instruction pipeline, How branching takes plac...

How branching takes place in Instruction pipeline. Explain with suitable examples

Cross bar-various interconnection networks-fully connected, Cross Bar ...

Cross Bar The crossbar network is the easiest interconnection network. It has a two dimensional grid of switches.  It is a non-blocking network and give connectivity among inp

Storage devices, Logic manufactures have produced 'large scale' logic (LSI)...

Logic manufactures have produced 'large scale' logic (LSI) blocks to achieve complex functions; a typical set of logic functions is that of data storage. There are two main types o

Concept of temporal parallelism, Concept of Temporal Parallelism In ord...

Concept of Temporal Parallelism In order to describe what is meant by parallelism inherent in the answer of a problem, let us talk about an example of submission of electricity

Main problems with evaluation functions, Main problems with evaluation func...

Main problems with evaluation functions: Superlatively, evaluation functions should be quick calculates. Wherever is chance they take a long time to estimate, so after then le

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