Businesses and government organizations often run simulations before coming to a conclusion to a problem, in order to see if a problem is solvable virtually before committing budget in the real world. Write a C program that computes a computer simulation of all possibilities given various simple conditions, but the possibilities can grow enormously beyond human abilities to solve manually!
The example here is based loosely off a folk story, where the objective is to fit a boat optimally with passengers and cargo. Write a C program that runs the simulation through all the possibilities for the rule set/conditions below and finds the optimal seating for the boats. (or close to that)
The rule set for a valid boat load is below:
– Seven spaces on the boat, maximum valid load = 185Kg
– Empty spaces are possible, but are a waste of space
– The passengers can be moved around any order, but the weight cannot exceed 185Kg
– “HH” A hunter (60Kg, two spaces), cannot be next to witch or python
– “TT” A tiger (75Kg, two spaces), cannot be put next to child or dog unless hunter is next to it
– “C” A Cat (25Kg, 1 space), cannot be put next to dog
– “D” A Dog (25Kg, 1 space), cannot be put next to cat
– “WW” A Witch (50Kg, two spaces), cannot be put next to dog or hunter
– “K” A Child (35Kg, 1 space), cannot be put next to luggage unless next to hunter or witch
– “P” A Python (25Kg, 1 space), cannot be put next to child or cat unless the witch is next to it
– “L” Luggage(s) (15Kg, 1 space), can be used to separate INCOMPATIBLE
passengers (luggage isn’t counted as a passenger, and multiple luggage can be used up to 3 times)
The output is in two parts:
a. Minimum number of passengers on the boat, with most weight? (Give the best 10 valid combinations and their respective weight, sorted best first)
b. Maximum number of passengers on the boat, with least weight? (Give the best 10 valid combinations and their respective weight, sorted best first)
Example output: (Italic fonts are used for loosely similar example output, XX is to substitute for actual output)
>>
a. Boat loadout with minimum passengers and most weight:
2,158 valid combinations
TTLCLPD = XX Kg
XXXXXXX = XX Kg
XXXXXXX = XX Kg
XXXXXXX = XX Kg
XXXXXXX = XX Kg
XXXXXXX = XX Kg
XXXXXXX = XX Kg
XXXXXXX = XX Kg
XXXXXXX = XX Kg
XXXXXXX = XX Kg
b.
Boat loadout with most passengers and least weight:
4,256 valid combinations
XXXXXXX = XX Kg
XXXXXXX = XX Kg
XXXXXXX = XX Kg
XXXXXXX = XX Kg
XXXXXXX = XX Kg
XXXXXXX = XX Kg
XXXXXXX = XX Kg
XXXXXXX = XX Kg
XXXXXXX = XX Kg
XXXXXXX = XX Kg
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more