Rovers problem in groovy