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.

Program that will blink as led, Take the last two digits of your UTCID. Thi...

Take the last two digits of your UTCID. This is your duty cycle in percent. If your duty cycle is less than 10%, add 30 to your number. Create an assembly program that runs on t

Explain their characteristics and limitations of grammar, Identify the diff...

Identify the different classes of grammar. Explain their characteristics and limitations. As proposed through Noam Chomsky that Chomsky hierarchy contains the subsequent level

JAVA, HOW WAS JAVA INVENTED?

HOW WAS JAVA INVENTED?

Flynns categorization, Flynn's Categorization Flynn's Categorization is...

Flynn's Categorization Flynn's Categorization is based on multiplicity of data streams and instruction streams observed by CPU at the time of program execution. Let I s and D

Explain elements of language grammer, Explain elements of language Gram...

Explain elements of language Grammer . As proposed through Noam Chomsky, a grammar G contains the following elements: a. A finite set N of non terminal symbols. b. A f

Function of in network access layer in tcp/ip protocol stack, What is the f...

What is the function of in network access layer in TCP/IP protocol stack? Function of Network Access Layer: The network access layer is the lowest layer within Internet

Explain the matlab language, This is a high-level matrix/array language wit...

This is a high-level matrix/array language with control flow statements, functions, data structures, input/output, and object-oriented programming features. It permits both "progra

Tag do you use to add a hyperlink column to the DataGrid, What tag do you u...

What tag do you use to add a hyperlink column to the DataGrid?   Anchor tag is used to add a hyperlink column to the data grid

Why the tcp checksum is necessary, Is the TCP checksum necessary? Yes, ...

Is the TCP checksum necessary? Yes, TCP Checksum is essential. TCP layer is liable for error detection, transmission of packets if needed, error control, reassembly of packe

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