From: Matthew Feadler Date: 2005-12-03T03:24:10+09:00 Subject: Re: Optimizing for Newbies damphyr wrote: > Jeeez, I haven't seen Ars Magica in a long, long while. Will probably > look at the code, but I just had to admire the fact that it still exists > (I've got almost all of 3rd Eds). > I always loved it (a lot more than D&D a bit less then CoC :) ) > This brings back memories. In reverse order: Glad I could spark the recollection, Damphyr. It certainly is my favorite system. Simon, I was unfamiliar with 'Struct' before your mention. Loking briefly here: http://www.rubycentral.com/book/ref_c_struct.html, it doesn't seem there's a way to establish relationships between the elements of the 'Struct', which I think defeats my purpose. Please enlighten me if I've misunderstood. Also, these rolls = Array.new(2){Die.new(10).roll} return 0 if rolls.any?{|r|r.zero?} are very cool. I was originally under the impression that the first line would create a two-element array *with the same Die instance in each element*, which would, of course, always result in a 0 total further down the code. I've tested it now, and realize that each element contains a seperate Die instance. VERY handy knowledge. The second line is an example of Ruby's lovely ? notation, which I've noticed all over, but have yet to really grasp/master. Thanks for this example. Neoneye, I had never seen the %w in this attributeShortNames=%w(Int Per Str Sta Pre Com Dex Qik) before, but looking here: http://www.rubycentral.com/book/intro.html I found it. Exactly the sort of Ruby shorthand I'm looking for. Now this Hash[*(attributeShortNames.zip(attributeFullNames).flatten)] is marvellous. A quick google (http://www.google.com/search?hl=en&lr=&q=ruby+zip+method&btnG=Search) doesn't give much for the zip method, so it's still a bit magical to me. Any references to recommend? As for the flatten method, looking here: http://www.rubycentral.com/book/ref_c_array.html, I see how it works. Very lovely. Thanks tremendously, all. You've given me much food for thought and practice. But don't stop advising on my account. ;) -Matthew -- Posted via http://www.ruby-forum.com/.