# Optimal Building Strategy Puzzle

Suppose a general is in charge of a mining site with 5 workers and he has a total of 50 units of gold. Each worker is able to mine for him 40 units of gold per minute.

The general is able to employ new workers for a total one of cost of 50 gold units (creating a worker takes 17 seconds and each mining site can only construct one worker at a time), but only 24 workers can exist at a mining site. The general can thus decide to construct a new mining site, costing 400 gold units (taking 2 minutes to construct), and with 2 mining sites, he can then construct 2 workers simultaneously, one from each mining site.

The general decides he wants to have a total of 3 mining sites. The general however is unsure of whether he should build any workers to increase income or if he should just wait until he has enough gold to purchase his 2nd or 3rd site.

What is the strategy the general should follow in order to minimize the time taken to achieve the three mining bases he desires? How many villagers should he build from each base and when?

• Is the worker cough SCV cough occupied for the 2 minutes it takes to built a mining site? Also, can a worker from one mining site be allocated to another mining site to avoid exceeding 24 workers at that site?
– xnor
Nov 19, 2014 at 6:43
• @xnor, yes the worker is occupied for the 2 minutes, and can be reallocated to different mining sites :) Nov 19, 2014 at 6:57
• Small correction: if this is about the game Starcraft 2, a Terran command center takes 100 seconds to build, not 2 minutes. I think this might be significant enough to change the suggested tactics. Nov 19, 2014 at 10:34
• @NateKerkhofs That change turns out not to affect my answer.
– xnor
Nov 20, 2014 at 0:36
• Awesome answer by xnor. I would like to add, thought, that Gilles didn't include an important detail is that while the first 16 workers actually mine something close to 40 per minute, the 17th up until the 24th only have an efficiency of around 30%. I think this doesn't change the answer but since it looks like your are going to try to apply the strategy in the actual game might as well try to have the most accurate model. Nov 28, 2014 at 9:38

Should the general build additional bases?

No. A single base is the way to go. The general should just save up to 800 gold units and build both bases at once.

How many workers should the general build?

Five workers, to get a total of 10.

When will the general have completed three bases?

295.5 seconds = 4 minutes and 55.5 seconds. This is two minutes after the first mining site is built at 175.5 seconds.

What build order achieves this time?

Build five workers, starting immediately. One will see that there's enough gold to build a worker as soon as the previous one finishes. So, the limitation is the 17-second build time. These workers are then finished at 17, 34, 51, 68, and 85 seconds.
I used a spreadsheet to compute how much gold one has at each of those times by updating the previous gold with the number of workers and mining rate.  Time Workers Minerals Time to 800 Total time 0 5 50 225 345 Worker built 17 6 56.6667 202.8333 322.8333 Worker built 34 7 74.6667 189.4285714 309.4285 Worker built 51 8 104 181.5 301.5 Worker built 68 9 144.6667 177.2222 297.2222 Worker built 85 10 196.6667 175.5 295.5

After 5 workers, just wait until you have 800 minerals to build both mining sites. The "Time to 800" column says the total time its will take to reach 800 gold if you build no further workers, and 5 additional workers optimizes that time. It allows the bases to be started at 175.5 sec and complete at 295.5 sec.

Why produce that number of workers?

A worker pays for itself after 75 seconds of mining, and so after 92 seconds counting building time. Building a sixth worker would not pay for itself as there are only 90.5 seconds remaining at that point. Building fewer workers doesn't help either, as can be seen from the spreadsheet. At the time the last worker is built, there's more than 92 seconds left before building, so it's worth it.

Why produce that number of mining bases?

Any additional base will have no benefit to use. We are nowhere near the cap of 24 workers on a mining base. Such a base would finish after at least 120 seconds, at which point we've already found it's not worth it to build workers, so additional production won't help. Each base it only worth it to reach to end goal. Since building a base occupies the worker that's building it and slows down mining, it's best to wait until reaching 800 minerals and starting to build both bases at once.

• Well done, that was a good job, and pretty quick too. Now time for me to put it in to practice! Nov 19, 2014 at 7:35
• Good luck! It's an ultra-aggressive double-expand though, you won't have much econ backbone and will be vulnerable to pretty much anything.
– xnor
Nov 19, 2014 at 7:37
• Me, I'd just use probes. None of this worker supervising their building nonsense... Nov 19, 2014 at 9:05