==> analysis/dog.s <==
Let L be the side of the square, 50m, and let D be the distance the
dog travels.
Let v1 be the soldiers' marching speed and v2 be the speed of the dog.
Then v1 = L / (1 time unit) and v2 = v1*D/L.
Let t1, t2, t3, t4 be the time the dog takes to traverse each side of
the square, in order. Find t1 through t4 in terms of L and D and solve
t1+t2+t3+t4 = 1 time unit.
While the dog runs along the back edge of the square in time t1, the
soldiers advance a distance d=t1*v1, so the dog has to cover a distance
sqrt(L^2 + (t1*v1)^2), which takes a time t1=sqrt(L^2 + (t1*v1)^2)/v2.
Solving for t1 gives t1=L/sqrt(v2^2 - v1^2).
The rest of the times are t2 = L/(v2-v1), t3 = t1, and t4 = L/(v2+v1).
In t1+t2+t3+t4, eliminate v2 by using v2=v1*D/L and eliminate v1 by
using v1=L/(1 time unit), obtaining
2 L (D + sqrt(D^2-L^2)) / (D^2 - L^2) = 1
which can be turned into
D^4 - 4LD^3 - 2L^2D^2 + 4L^3D + 5L^4 = 0
which has a root D = 4.18113L = 209.056m.