At the tree turn 90 degrees to the left and then walk forward the same number of steps. At the point where you top drive a spike into the ground. When you reach the tree, turn 90 degrees to the right and take the same number of steps forward, placing another spike at the point where you stop. However, our hero when he gets to the island finds the gallows missing. If the trees are fixed, the position of treasure does not depend on the position of gallows.
B is on x axis at distance one.
Hence position of treasure depends only on the position of trees. A then walk half the distance towards tree B, turn right and walk the same distance to the treasure.