Puzzle node problems in Scala