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.

How does VB.NET achieve polymorphism, How does VB.NET/C# achieve polymorphi...

How does VB.NET/C# achieve polymorphism?  VB.Net / C# give polymorphism through the following mechanisms: 1. Inheritance - base class gives overridable methods which are re-

Grapgh, representation of the adjacency matrix and adjacency list

representation of the adjacency matrix and adjacency list

What are local objects, What are local objects? Local objects (Dev clas...

What are local objects? Local objects (Dev class$TMP) are independent of correction & transport system

Illustrate the application of e-commerce in home banking, Illustrate the ap...

Illustrate the application of E-Commerce in Home Banking. Home Entertainment: E-commerce has show the way to HOME ENTERTAINMENT. The video aspect generally includes a la

What is the use of buffer register, What is the use of buffer register? ...

What is the use of buffer register? The buffer register is used to avoid speed mismatch among the I/O device and the processor.

Experiment with neural network, Assignment 3.b: Experiment with Neural Netw...

Assignment 3.b: Experiment with Neural Network Background: In this assignment, you will experiment with neural network for solving different types of practical problems. Y

What is the draw back of micro programmed control, What is the draw back of...

What is the draw back of micro programmed control? It leads to a slower operating speed because of the time it takes to fetch microinstructions from the control store.

What does the ''suppress dialog'' do, What does the 'SUPPRESS DIALOG' do? ...

What does the 'SUPPRESS DIALOG' do? Suppressing of whole screens is possible with this command.  This command permits us to perform screen processing "in the background".  Sup

Asynchronous and Synchronous types of serial communication, Differentiate b...

Differentiate between asynchronous and synchronous types of serial communication. Serial data communication uses two fundamental types, asynchronous andsynchronous. With synchr

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