Adds function to calculate distance from goal for any piece of puzzle