# The Geometry of Empire 2: How to Stop an Invasion

Last time, we considered the defensive units that travel to the edge of a territory to intercept attackers. But what if those attackers don’t stay put, but invade the territory instead? Where should the defenders be?

## The Situation

For simplicity, let’s assume attackers that move inexorably to the center of the territory, hoping for more plunder the farther they go. If we again look at a single sector, the defenders must move to the attacker’s path, and the worst case is a path at the edge of the sector — since it’s farthest away from the midline, where the defender should be.

Many interception points along the attacker’s path are possible, but the defender wants the quickest one. This means the he does not want to move as quickly as possible to the attacker’s *path* only to wait for the him to arrive; instead he wants to meet him directly, while moving. If the two units have the same speed, they will have to travel the same distance before meeting.

This can define a circle, originating from the (unknown) interception point, with radius equal to the travel distance, and the units’ starting points lying on its edge:

The question is, where is the center of this circle? Let’s first look at the extreme starting positions, to see if we are missing a move obvious solution.

## Extreme Starting Positions

The worst we could do is to position ourselves, as the defender, on the edge of the territory. We will only be able to catch an attacker at the center of the empire, and we must travel its entire radius to meet them there:

A better possibility is starting at the center of the territory to begin with. We will always be able to ride out and meet a attacker at the half-way mark:

You’ll notice that the circle intersects the midline at a second point; another possible defender position. Interestingly, this is the ideal position we found last time, for meeting the attacker at the border.

We cannot do very well being between this point and the edge; and the center-point is equivalent. Can we do better?

## The Ideal Position

It turns out that we can do better. In the examples above, the interception circle gives positions where it hits the midline. But what is the smallest possible interception circle? It should fit exactly fit into the sector half, intersecting the midline just once — that would give us the shortest path to the attacker.

On paper you could construct this point with some trial and error (and perhaps there is a nicer method) but how would we calculate it?

Our interception path to the attacker (DB) is shortest when it is a tangent to the midline (AB). This implies a right angle, allowing familiar right-angle trigonometry identities. We also know the angle a, based on the number of sectors; that BD and CD are equal, and the length AC (the territory radius; 1).

AC = 1

AB = 1-BD

CD = BDsin(a) = BD / AD

sin(a) = BD / (1-BD)

BD = sin(a) / (sin(a)+1)tan(a) = BD / AB

tan(a) * AB = sin(a) / (sin(a)+1)

AB = sin(a) / (tan(a) + tan(a) * sin(a))

This gives the distance from the center of our interception point. It can be cleaned up to yield:

In our particular example, of a four-sector territory, this yields a distance of 41%. We can also easily find the distance traveled by both units using the tangent — in this case only, also 41%. Here is the trade-off for a variety of sectors:

The qualitative pattern is just just like last time’s: increasing the number of sectors quickly pushes defenders out, but this trend slows.

## Comparing to Interception-at-the-Edge

Our defenders’ ideal positions are much closer in this time though. If you recall, with four sectors, our best spot was 71% out when we only wanted to intercept at the edge. Now it’s 41%.

This pattern is true for other sector configurations as well. Here are the two sets of ideal spots for all of six sectors:

The difference between the two ideals does shift with the sector total though:

It turns out that the difference between the two positions is greatest with 5 sectors. They’re the same with 1 or 2 defenders (i.e. the center) and would be the same if you imagine an infinite number of units strung out along the border — the attacker really can’t move then, because he’s intercepted immediately.

Let’s turn to the difference in interception distances. It’s is not greatest at 5 sectors, but at 2; and the more sectors you have, the more equivalent the two outcomes are:

Moving attackers will be intercepted more quickly than those that stay put at the border — assuming the defender was ready for them. A defender who doesn’t know what his opponent will do, however, might prefer a larger number of sectors/defenders, so the difference won’t matter.

But this starts to become an issue of strategy, which we’ll take up next time.

*Next time: Should attackers choose to move or stay at the edge? Does this depend on the territory? And are there stable strategies for the defender to adopt, no matter what his enemy does?*