Depth first maze builder in Scala