Use regular expressions in ruby to navigate mazes