Question: 2 . [ The Teacher 3 ] : In the game Teacher 3 , the protagonist, Geralt of Oblivia, battles demons. We are nearing
The Teacher : In the game "Teacher the protagonist, Geralt of Oblivia, battles demons. We are nearing the completion of the game, with only one boss fight remaining.
Before facing the final boss, Geralt must confront n waves of monsters. Before each wave, he can purchase health potions to prepare for the upcoming fight. Any potions not used in one wave can be saved for subsequent waves. Monsters drop coins, which Geralt can use to buy more potions.
After researching online, we have gathered information about what to expect during each fight. In wave i Geralt needs di health potions to survive the wave. The cost of a potion before wave i is denoted by ci and during wave i the monsters will drop pi coins in total.
Our objective is to acquire enough potions before each wave to ensure Geralt's survival while minimizing the total amount of coins spent on the potions. The cost of potions before each wave depends on whether you play the game in the easy setting or the hard setting. Suppose that before the first wave, Geralt has no health potions, and he has P coins to purchase some. Note that if P is insufficient, it might be impossible for him to survive all the waves.
aEasy Mode: In this scenario, the cost of a health potion decreases after each wave, ie cccdotscn
i
What is the best strategy to ensure Geralt's survival while optimizing the total remaining coin balance at the end of all waves? The complexity of your algorithm should be linear.
ii Argue that your algorithm is optimal.
bHard Mode: In this scenario, the cost of a health potion does not follow a particular pattern.
i
To solve the problem, we have to first pick a problem structure. It's important to
note that your decision before each wave depends on three factors: the amount of money you have, the quantity of health potions you have, and the number of waves that have passed.
Define a suitable OPT for the problem, taking into consideration these three factors.
ii What is the goal of the problem, in terms of OPT?
iii. Write down the Bellman equation for OPT. Describe your equation.
iv What is the complexity of your algorithm? Justify your answer.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
