Let's draw a map. We can choose any orientation and scale we want.
so let $A$ be $(0,0)$ and $B$ be $(0,1)$. Let $S$ be $(u,v)$. We don't know what those are.
The distance from $S$ to $A$ is $\sqrt{u^2 + v^2}$. The slope of $SA$ is $\frac vu$. (We'll have to make a special exception if $u=0$). And the equation for line $AS$ is $y = \frac vu*x$. The slope of $AC$ is therefore $-\frac 1{\frac vu} = -\frac uv$ (We'll have to make a special exception if $v = 0$) and the formula for $AC$ is $y= -\frac uv*x$.
So if the point $C = (a,-\frac uva)$ then the distance for $AC$ is $\sqrt{a^2 + \frac {u^2}{v^2}a^2} =|a|\sqrt{1 + \frac{u^2}{v^2}} = \sqrt{u^2 + v^2} = |v|\sqrt{1 + \frac {u^2}{v^2}}$ so $|a| = |v|$ and $C= (\pm v, \mp u)$.
The distance for $S$ to $B$ is $\sqrt{u^2 + (v-1)^2}$. The slope of $SB$ is $\frac {v-1}u$ so the slope of $BD$ is $-\frac {u}{v - 1}$ (again, special exception if $v = 1$). The equation of line $BD$ is $y = -\frac u{v-1}x + 1$.
So if the point $D = (b, -\frac u{v-1}b + 1)$ then the distance from $BD$ is $\sqrt{b^2 + (-\frac u{v-1}b)^2}=$$|b|\sqrt{1 + \frac {u^2}{(v-1)^2}} $$= \sqrt{u^2 + (v-1)^2} = |v-1|\sqrt{1 + \frac{u^2}{(v-1)^2}}$
So $|b| = |v-1|$ so $b = \pm v \mp 1$ and $D=(\pm v\pm 1, \mp u + 1)$
So there are four possible possible positions for the gold. They are:
$(\frac {v+v+1}2, \frac {-u-u + 1}2) = (v + \frac 12, -u + \frac 12)$. We're screwed. We'll never find it. We curse our father and wonder why he couldn't have simple told us whether we have to turn left or right at points $A$ and $B$. If we turn right at $A$ and right at $B$ we'll never find it.
$(\frac {v - v - 1}2, \frac {u-u + 1}2) = (-\frac 12,\frac 12)$. We dig there and hope our father meant we turn right at $A$ and left at $B$.
$(\frac {-v + v + 1}2, \frac {-u+u + 1}2) = (\frac 12,\frac 12)$. We dig there and hope our father meant we turn left at $A$ and right at $B$.
$(\frac {-v-v-1}2, \frac {u+u + 1}2) = (-v - \frac 12, u + \frac 12)$. We're screwed. We'll never find it. We curse our father and wonder why he couldn't have simple told us whether we have to turn left or right at points $A$ and $B$. If we turn left at $A$ and left at $B$ we'll never find it.