I've become addicted to the Forge of Empires web browser game. Presently, the game has a special event going on, which is in commemoration of the 2016 EUFA Soccer Championship. The event has a set of probability-based challenges and I would like to use Mathematica to figure out the best use of my resources.
Goal (heh) of the event
Take a penalty shot, score, and gain points (aka cups). Cups can be traded in for prizes. You receive one credit per hour to take one shot at the goal. You can make four different types of shots, each with a different chance of earning cups. The riskier the shot, the greater then number of cups awarded if successful.
Rules of the event
I probably do not have these starting values correct, but it may not be relevant as you'll see below
Initially, each of the four shots has a base score of points that can be rewarded:
- A shot with 100% chance of scoring rewards 10 cups
- A shot with 20% chance of scoring rewards 40 cups
- A shot with 10% chance of scoring rewards 60 cups
- A shot with 5% chance of scoring rewards 100 cups
If a shot is missed, then the reward increases:
- 20% shot increases by 5 cups per miss
- 10% shot increases by 10 cups per miss
- 15% shot increases by 15 cups per miss
My objective is to figure out which shot is best to take
My approach to the problem thus far has been to create a set of random integers with a range appropriate so that the presence of a "1" indicates success, find the positions of the 1's, and calculate the differences between those positions to figure out how much the pot has increased each time. The code looks something like this:
cups[prob_, inc_, base_] := Module[{shots, wins},
shots = RandomInteger[{1, prob}, 1000];
wins = Position[shots, 1] // Flatten;
Sum[inc i, {i, #}] + base & /@
Prepend[Differences[wins], First@wins] // Total
]
One example output using MapThread[
cups[#1, #2, #3] &, {{5, 10, 20}, {5, 10, 15}, {40, 60, 100}}]
gives me points of 30k, 107k, and 317k for each, suggesting to me that I should always stick with the lowest probability shot because over time, it will provide me with the greatest payout. Is my thinking on this correct?
The real challenge
The hard part, which I have no idea how to model, is that all players in my neighborhood influence the rewards. For example, if there is one player in my neighborhood (typically, there are 80), and she misses a 1-in-20 shot, then my potential reward for a 1-in-20 shot is increased by 15 cups. Likewise, if she wins the attempt, the reward is reset to its base. How might I incorporate this complexity into my model?
May the best country win, and may your relatives (who scored tickets to the game while you are at home working) not be terribly affected by the endless strikes, currently underway in France.