📜 ⬆️ ⬇️

Time management games: how to make calculations and pass the intricate level

Recently tried time management game. The plot is typical for games of this genre - using certain opportunities to manage a limited amount of resources to achieve a given goal for a limited time. I liked the toy, but there was a plug at level 11. In order to achieve the desired asterisk (what can you not do for the sake of virtual buns?), I decided to go wisely and do some calculations in order to discard useless strategies and still keep within the allotted bonus time. This article is about what I did and what results I got.

Description and level task


Here is the original level 11 map:



I will begin with a description of what is on it and what will be encountered in solving the problem.
  1. Castle. Here are the units under our control: builders and tax specialists. Builders build, improve and demolish objects, clear debris, dig up treasures, extract wood at a sawmill. Tax officers collect rent from residential buildings, enter into market transactions for the sale of wood, pay ransom to pirates.
  2. Cottage. One of the two available types of residential buildings. In addition to them, you can build cheaper, but less profitable huts.
  3. Market. Here you can change the tree for gold. In one transaction, you can choose one of three offers.
  4. Blockage Limits the movement of units. When it is eliminated, it adds 10 wood units to the warehouse.
  5. Treasure Having dug it up, it is possible to enrich yourself quite well (a freebie sir!).
  6. Pirate. Limits the movement of units. He leaves after he is paid a bribe (he must not be offended for the State).
  7. Stock. Available resources and units.
  8. Tasks level. In this case, you need 5 houses (cottages or huts) with a garden.
  9. Bonus time indicator. We want to complete the task before it runs out.

In addition, for construction available:
')
Sawmill. Here you can, having a sufficient amount of gold, saw the wood needed for the construction of all other buildings.
Hut. One of the types of residential buildings. Cheaper, but less profitable than a cottage.

Resources


Initial resources:

Resources needed for building and improving buildings, rent:
Building or improvementGoldTreeBuildersRent
Hut75one100
1 hut improvement15one125
2 hut improvementthirtyone175
3 hut improvement452250
Hut garden25one
Cottage150one200
1 cottage upgradethirtyone250
2 cottage improvement60one350
3 improved cottage902500
Garden for the cottage50one
Sawmill1000one
Market250one

Sawmill (cost of wood extraction)
Amount of tree obtainedPrice in units of gold
50500
1001000
2002000

Time:
ActTime to perform an action (in seconds)
Parsing the damten
Hoard diggingten
Rent Renewal20
Remove the rent3
Update Market Offer20
Conclusion of a market transactioneight
Making a deal with a pirateten
Building constructionten
Demolition of a buildingten
Wood sawingeight
Garden shatteringeight
Building level rise6

Treasure The map contains two hoards. The one on the left of the screen is 5,000 gold, and the one on the right is 1,000 gold.

In order to open the passage to the right side of the screen, you need to pay the pirate 10,000 gold.

Bonus time level - 320 seconds.

Finding a solution


The choice of the line of conduct at this level is complicated by the fact that the offers on the market are formed randomly. In order to understand how best to act in this situation, I made a sample of 100 market proposals:

Selection of market offers
Gold, Tree, Gold, Tree, Gold, Tree
100,10,500,40,500,20
1000,40,100,10,200,10
200,10,800,20,100,10
500,20,500,10,100,10
200,20,800,20,500,20
100,10,500,40,200,10
200,20,100,10,800,40
100,10,200,10,800.20
500,40,200,20,500,20
800,20,200,20,100,10
800,20,800,40,100,10
200,10,800,40,500,10
100,10,200,20,500,20
200,20,100,10,500,20
500,40,100,10,200,20
800,40,500,20,100,10
100,10,200,20,500,10
800,20,200,10,100,10
500,20,100,10,800,20
200,20,800,20,100,10
500,10,800,40,100,10
100,10,500,10,200,10
1000,40,500,20,800,20
100,10,1000,40,500,10
800,40,500,10,200,20
500,40,200,20,500,20
500,10,200,20,800,20
100,10,500,20,500,40
200,20,500,40,500,10
500,40,800,20,800,40
200,20,500,40,800,20
100,10,200,10,200,20
100,10,800,20,200,10
500,40,500,10,200,20
800,20,500,10,200,10
200,20,500,40,800,40
100,10,200,20,800,40
200,20,500,10,500,40
800,20,100,10,200,20
200,20,100,10,200,10
800,20,200,20,500,10
500,40,1000,40,100,10
500,40,800,40,100,10
800,40,100,10,500,40
200,10,200,20,800,40
200,20,800,40,100,10
800,40,200,20,500,40
100,10,800,20,500,10
200,20,500,10,1000,40
200,10,100,10,800.20
800,40,200,10,200,20
100,10,800,20,500,40
500,10,200,20,800,40
800,40,500,20,200,20
800,40,200,20,100,10
500,20,800,20,500,10
500,10,200,20,500,20
200,10,100,10,1000,40
100,10,200,10,500,20
800,40,100,10,200,20
200,20,500,10,800,20
200,20,500,20,100,10
200,20,200,10,100,10
100,10,500,10,200,10
200,20,800,40,100,10
800,20,800,40,1000,40
500,10,200,10,500,20
200,20,800,40,1000,40
200,20,500,20,100,10
500,20,800,40,500,40
100,10,200,20,500,20
800,20,200,10,200,20
500,10,100,10,200,10
100,10,200,20,500,20
800,20,500,40,100,10
200,10,500,10,500,40
200,20,100,10,800,20
200,20,800,20,100,10
200,20,500,40,200,10
100,10,800,20,200,20
1000,40,800,20,200,20
500,10,100,10,200,10
100,10,500,20,500,10
200,20,100,10,500,20
800,20,500,40,200,20
100,10,500,10,500,40
100,10,500,10,800,20
500,20,100,10,500,10
800,40,100,10,200,20
200,20,500,20,500,40
100,10,500,10,500,40
200,20,1000,40,800,40
200,10,800,40,100,10
100,10,200,20,800,40
500,10,200,10,500,40
100,10,200,20,800,20
100,10,1000,40,200,10
200,10,800,40,200,20
200,20,500,10,800,40
800,20,1000,40,500,20

On the basis of the data obtained, it is necessary to draw up a trading strategy (that is, a strategy for selecting random market offers). As such, I took the following:

Net profit is calculated taking into account that 10 units of wood cost 100 units of gold. Now you can analyze the data and get a table of frequency of profitability:
Net profit from the transactionFrequency of appearance of the option with such profit
1000.06
3000.13
4000.41
6000.4

From here we get that the average profitability of a single transaction is 450 gold units!

In order to accomplish the task of the round, you need to build 5 residential buildings, and in the part accessible to us there are only 4 potential construction sites, so the right side to open is absolutely necessary. Thus, our task falls into two stages:
  1. Open the right side of the screen (i.e. earn as soon as possible 10,000);
  2. Rebuild the required number of objects.

Consider the first stage. How to quickly earn 10,000 gold? To solve this subtask, you can offer several options:
  1. To demolish the market, in its place to build a sawmill and combine the receipt of rent from the cottage with the profits from commercial transactions.
  2. Demolish the cottage, in its place to build a sawmill and receive only trading income.
  3. To demolish the markets and build cottages or huts in their place, receive only rent.
  4. Nothing to demolish, and sell the tree, obtained from parsing debris, with the greatest benefit.

Let us consider these strategies in order.

Strategy # 1


We have 110 units of wood and about 6000 gold (it is assumed that the cottage will bring 1000 gold during the first stage). As a result, we plan to receive 11,000 gold (10,000 for the redemption + 1000 for the construction of a sawmill) and 350 units of wood (for the construction of 4 huts we need 400 units of wood, for the garden in the cottage - 50, we expect to produce the missing 100 units of wood treasure).

In order to calculate how long it may take to accumulate the necessary amount of resources for this strategy, we use the Monte Carlo method .

The simulation results that answer the question: “What is the probability that N market transactions will be enough for us to achieve this goal?” Are shown in the table:
Number of required market transactions (N)The number of favorable casesThe probability that there will be exactly N transactions (%)
13130.0
147480.7
1564086.4
sixteen1968819.7
172915729.2
182437124.4
nineteen1311413.1
2048284.8
2113301.3
222880.3
23500.1
24five0.0

In this case, we have 2 markets available. One transaction lasts about 35 seconds (20 seconds to update a deal, 3 seconds to make a choice of a deal option, 4 seconds for the taxman to reach the market and 8 seconds to close the deal).

It turns out that you have to make from 7 to 12 visits to get the required number of transactions. Calculate the time required to make such a number of visits.
Number of visitsThe probability that such a number of visits is enough (%)The time required to implement this maneuver (seconds)
70.77 * 35 = 245
eight26.18 * 35 = 280
953.635 * 9 = 315
ten17.935 * 10 = 350

Calculate the cost of time for further action. We need to make a ransom, dig up the treasure and build 4 huts with gardens, after eliminating 2 markets. 10 (demolition of 2 markets and redemption) + 10 (dig up treasure and build 2 huts) + 8 (sawing firewood and splitting 2 gardens) + 18 (building 2 more huts with gardens) + 20 (operating costs and expenses for moving units) = 66 seconds. Add here another time to analyze the debris at the beginning of the level (15 - 20 seconds) and we get that you need about 80 - 85 seconds.

As a result, we obtain that, guided by this strategy, we have no chance to complete the task.

Strategy number 2


We have 110 pieces of wood and about 5,200 gold. As a result, we plan to get 11,000 gold and 400 wood units. Having done the same calculations, we got:
Number of required market transactions (N)The number of favorable casesThe probability that there will be exactly N transactions (%)
sixteen1230.1
1716911.7
1887458.7
nineteen2089420.9
202726427.3
212214522.1
221236212.4
2348564.9
2414441.4
253850.4
26790.1
27ten0.0
2820.0

Given the fact that we have 3 markets, we need to make 6 - 9 visits.
Number of visitsThe probability that such a number of visits is enough (%)The time required to implement this maneuver (seconds)
610.46 * 35 = 210
770.37 * 35 = 245
eight18.78 * 35 = 280

In this case, in comparison with the previous one, we need to build a hut with a garden longer, that is, we need an additional about 20-25 seconds (in the amount of 100-110 seconds).

Thus, when implementing this strategy, the level can be passed in 10.4% of cases.

Let's try to implement this approach in practice:



To achieve this result took 5 attempts. As a result, the goal has been achieved. We could stop at this, but we will briefly review the remaining strategies.

Strategy number 3


This strategy seems to be completely unpromising. The cycle time for receiving annuities is comparable to the cycle time of a market transaction, but trading, as has been shown, brings more than 2 times more gold.

Strategy №4


This strategy is most likely not to work because it prefers waiting for action. In general, it could be investigated in more detail. I have no doubt that the interested reader will be able to do this on his own.

Conclusion


The task is solved, the goal is achieved, but the results are not particularly encouraging ...

Find a strategy that would lead to success at least 50% of cases failed. The question of the existence of such a strategy is also open. There is no guarantee that it exists at all in this particular case.

The results suggest that it might be worth making some adjustments to the conditions of the round, in order to make it more passable, because we like as a casual game. What can be done to increase the probability of passing?
  1. Increase bonus round time. If you increase the bonus round time by 35 seconds, the permeability (strategy # 2) will exceed 80%.
  2. Reduce the size of the ransom or increase the amount of the treasure. If you reduce the ransom by 1000 gold, the permeability (strategy No. 2) will increase to 65%.

Despite the fact that the results did not please me, the game, nevertheless, delivered a lot of pleasant sensations. I think that anyone who plays this game has found it fascinating and will enjoy the gameplay, and this is the most important thing.

Source: https://habr.com/ru/post/257537/


All Articles