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.

Complex micro-controller, The 68Hc11 is actually a complex micro-controller...

The 68Hc11 is actually a complex micro-controller its contains internally RAM, EEPROM, Parallel IO and serial ports, hardware timers and a 8 channel ADC.  The internal structure is

Write truth table of combinational circuit, A combinational circuit has 3 i...

A combinational circuit has 3 inputs A, B, C and output F.  F is true for following input combinations A is False, B is True A is False, C is True A, B, C are

Perfect induction, Any identity or equality in Boolean algebra, suchas de M...

Any identity or equality in Boolean algebra, suchas de Morgan's Theorem can be proved usingthe method of perfect induction. 1. All combinations of variables are written down.

How to use activex control in .net, How to use ActiveX Control in .Net ? ...

How to use ActiveX Control in .Net ? ActiveX control is a special type of COM component that handles a User Interface. Using ActiveX Control in your .Net Project is even simple

When should the method invokelater() be used, This method is used to make s...

This method is used to make sure that Swing components are updated by the event-dispatching thread.

Command line argument value, Make a console application to show different m...

Make a console application to show different messages depending on the command line argument value. Use Select-case statements.(same to switch block)

BCD ADDER, create a BCD adder combinational ckt. that adds 2 digit BCD inpu...

create a BCD adder combinational ckt. that adds 2 digit BCD inputs

Link your documents to site, Images in the top area of Compass home page gu...

Images in the top area of Compass home page guide visitors to specific pages on the site. Now you will add links for navigation buttons. You will see that there are some ways to

Application of connect-4 game, The game Connect-4 is played on a board that...

The game Connect-4 is played on a board that has seven columns. There are six spaces on each column. The board is initially empty. Two players take turns dropping one piece (black

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