6

I was playing Clash of Clans and came across this interesting problem. Consider the case when I'm attacking an enemy war base with an Archer. My archer can cause a damage of 12 hitpoint per second. The enemy's Archer Tower has a total hitpoint of 580, meaning it will take 580/12 hits by one archer for it to be completely destroyed.

The enemy Archer Tower can attack the archers too. The tower's damage-per-second value is 35, and the hit points of an archer is 28. So in a single shoot, the Archer Tower can kill one archer.

For example, if I deploy 10 archers to take out the enemy Archer Tower:

t = 1 second: 10 archers attacking : 12 x 10 hitpoints total; Remaining hitpoints of Tower = 580 - (12 x 10) = 460 hitpoints

t = 2 second: 9 archers attacking (1 archer is dead by now): 12 x 9 hitpoints total; remaining hitpoints of tower = 460 - 108 = 352 hitpoints

t = 3 second: 8 archers attacking (2 archers are dead by now): 12 x 8 hitpoints total; remaining hitpoints of tower = 352 - 96 = 256 hitpoints

My question is:

How many archers do I need to deploy to destroy the Archer Tower completely(assuming the Tower attacks the archers at the same time)?

  • I hope I'm clear. If anything doesn't make sense, please do ask, and I'll try my best to explain. – Joseph John May 22 '15 at 14:24
  • What are the target acquisition dynamics? Do the archers focus fire? Is there a time of flight for the arrows? Will there be multiple wasted arrows if the target dies early? In these sorts of situations the target acquisition can make a MASSIVE difference: it could make the difference between losing and a swift victory. My advice would be to simulate this, because the crucial target acquisition and time of flight dynamics will simply be too complicated for any pencil and paper calculation. – Gappy Hilmore May 22 '15 at 14:38
  • It also has not been clearly stated how frequently each unit (and enemy tower) fires. Yes, you mention they do 35dps, but often times a number like that is given in a game as an average and they in fact fire once every second and a half or once every three quarters of a second, etc... – JMoravitz May 22 '15 at 14:40
  • @grdgfgr: No need to make it too complicated. The archers do focus fire. The time of flight is negligible. Since the archer tower will be attacking a single target at any given point of time, yes, there will be wasted arrows. I'm not sure how to run a simulation for a game like this, hence my question. – Joseph John May 22 '15 at 14:49
  • This kind of thing can be done easily by a spreadsheet, where each unit of time is a single line of the spreadsheet. (In this case, though, Hagen von Eitzen's answer provides an formula.) – David K May 22 '15 at 15:15

2 Answers2

7

I assume that the Archer Tower cannot split its $35$ damage over several archers. Then a group of $n$ archers can survive for $n$ seconds and cause $6(n^2+n)$ damage (this is because $1+2+\ldots+n=\frac{n^2+n}{2}$). So $9$ archers can cause $540$ damage and $10$ can cause $660$ damage before they are wiped out one by one.

2

Assuming worst case scenario (tower perfectly focus fires your archers and tower wastes no dps)

You will need 10 archers and at least 3 of your archers will survive. If you have 9 archers, you will be wiped out if tower does a perfect job. If tower does not do a perfect job, 9 archers will likely be enough.

  • Can you explain the calculation? – Joseph John May 22 '15 at 14:50
  • https://i.imgur.com/XXQtub8.png

    I wrote a script and tried it for different archer counts. Each round takes 28/35 seconds, all alive archers deal 12 damage per archer and at the end of each round 1 archer dies.

    – Gappy Hilmore May 22 '15 at 14:53
  • I don't know what language is that. I tried to port that to PHP, but it shows 6 as the output. Can you maybe tell me what the problem is? https://eval.in/368730 – Joseph John May 22 '15 at 15:04
  • Also, why (12 - i - 1) instead of (12 - i)? – Joseph John May 22 '15 at 15:06
  • because i starts at 1, but at i=1 no archers have died yet. (i-1)=archers that have died at that point. There is no (12 - i - 1) in my code, there is 12*(n-i+1). The language is matlab, and matlab has a weird indexing. Indexes start at 1, not 0. – Gappy Hilmore May 22 '15 at 15:13