implementing the first pass of distSnake