+1 on object creation
There's a Ruby tutorial somewhere on the interblag about creating a
mini-adventure game. It begins like this:
def Thing
attr_accessor :name, :description
end
And everything starts from there.
def Weapon < Thing
end
def Sword < Weapon
end
etc etc. You probably don't need that much breaking down, but it seems
you do need to break it down some ;-)
The basic way to think about it is : if I can't explain it in three
sentences or less, I have to break it down.
If you REALLY REALLY REALLY wanted to create some kind of iterating
name, you could always do things like
iterator = 0
array = []
while iterator < 30
array << "a#{iterator}".to_sym
iterator += 1
end
But that's really dirty...
--
Posted via http://www.ruby-forum.com/.