Boggle solution in ruby