* Pedro <pedro.wotan / mundo-r.com> [2005-05-25 06:33:24 +0900]: > Here's my solution, and without googling!. > > I'm new in Ruby, and I have a little doubt in my solution. The to_s > method is too slow in the way I implemented it, Is there any better > approach?. > Yes. There are a couple of things you can do. > def to_s > cad = '' > @tiles.each_index { |i| ># cad += @tiles[i] + ' ' cad << @tiles[i] << ' ' ># cad += "\n" if i%@w==@w-1 cad << "\n" if i%@w==@w-1 > } > return cad > end The other thing you can do (with some extra modification) is start with: cad = [] and when you are done, do cad.join("\n") -- Jim Freeze Ruby: I can explain it to ya but I can't understand it fer ya.