From: Ruairidh Mchardy Date: 2008-11-04T02:57:58+09:00 Subject: Re: Text Based RPG in Ruby Hi there Hugh, I'd previously taken a look at Dwemthy's array (Poignant Guide to Ruby right) and it is undoubtedly a nice implementation of a text-based RPG in Ruby. My problem is that I'm extremely stubborn and even lifting a line of code makes me feel dirty. I want this program to be 100% written by me. I know that doesn't stop me learning from others but I often end up writing code that is far too similar for my liking! Also on a slightly embarassing note, my ruby skills are not to the level where I can easily understand snippets such as: define_method( :initialize ) do self.class.traits.each do |k,v| instance_variable_set("@#{k}", v) or def self.metaclass; class << self; self; end; end def self.traits( *arr ) return @traits if arr.empty? attr_accessor(*arr) arr.each do |a| metaclass.instance_eval do define_method( a ) do |val| @traits ||= {} @traits[a] = val And so my code is far less efficient and rather ugly too :( Thanks for the link though! Kind Regards, Ruairidh McHardy Hugh Sasse wrote: > On Tue, 4 Nov 2008, Ruairidh Mchardy wrote: > >> @hp =100 >> This throws up no errors and although the hit assignment is poor, it >> remains functional. > > Excuse me blundering into this thread, but you may find: > > http://blog.jayfields.com/2008/07/ruby-dwemthys-array-using-modules.html > > and its associated links interesting reading. > > HTH > Hugh -- Posted via http://www.ruby-forum.com/.