Reference no: EM133672375
Implement the parts a, b and c into given skeleton code
Baldur's Door is a new computer role-playing game based on the setting of a popular table-top game called Delves & Drakes, the game features an extensive variety puzzles and mechanics which critics have lauded as interesting and allowing for diverse modes of play. The game's characters take on quests which lead to puzzles.
Part A
In the early quests of the game, the town's tavern is advertising exciting new flavours for their soups. The cook has promised 500 silver pieces for each novel ingredient on their list gathered. Though appearing generous for ingredient gathering in the nearby forest, the party cleric noticed that each ingredient requires crawling between poison bushes. The party rogue has the smallest build and will likely be able to crawl through the bush without being scratched too badly - but will surely be afflicted. Once the poison takes hold, each step taken will passively do a fixed amount of damage. The cleric's healing spell can only be tasted once the party rogue has exited the narrow space. Since each casting of the healing spell requires expensive magical materials, you will have to find the route that reaches the exit in the least possible steps.
An example of the forest pathways are shown below, where each edge represents a step and each node represents a location the rogue can step to:
The forest layout above would be represented by the input to your program:
Where:
• the first line ( a ) is the number of locations the rogue can possibly step,
• the following line (11 ) is the number of connections between locations,
• the third line (a) is the location the rogue starts at
• the fourth line ( 5 ) is the location the rogue exits the space and is in range to be healed, and
• all following lines are pairs, indicating an undirected connection between the two locations.
You may assume the list is sorted numerically by the first location and then (where the first location is equal) by the second location. You may also assume locations are always equal to or greater than 0 and numbered less than the number of locations.
The output should be the damage taken - assuming one point of damage is taken per step.
Part B
After hearing the ease with which our protagonists were able to deal with the poison forest, a local merchant staying at the tavern asks if the party would be interested in a challenge. The merchant had come into possession of a number of lair maps that showed the locations of all the traps in each lair. The merchant confessed they did not have any non-mercantile skills but had managed to purchase information on how to disarm each trap. After discussing the skills the party held, the merchant explained the cost of the materials they'd need to disarm each trap they had the skills to disarm and marked this total cost on each pathway. To preserve the most treasure, you'll need to find the cheapest path through the lair.
Here is an example of one of these maps:
This map would be represented using the following format
Which is the same as the format for Part A, but each edge specified includes an additional third number describing the cost of disarming the trap. You may also assume that all costs will be non-negative.
Part C
To reward the adventurers for their extensive help connecting the merchant with their extensive treasures, they share their own prior connections. The documents they share detail artisans who will offer ongoing services for a particular price-each artisan on the map is able to create one material from another and reverse the process. Each document is limited to the connections for a particular set of materials which are related in some way. Since the general store merchants offer a new daily special periodically, having a network which allows the creation of all materials from any material in the documents will save a lot of money in future adventures. You will have to find the gold you'll need to build the network which allows any material to be reached from any other material in the document.
Here is an example of one of these documents:
Which is similar to the format for Part 8, but excludes the fourth line that would normally specify the final destination.
The output will be the minimum cost required to pay across all artisans such that each material in the document can be made from any other material.
Attachment:- role-playing game.zip