Port ObstAndDist to Scala