Grid data structure in ruby