On Oct 1, 2006, at 12:29 PM, Leslie Viljoen wrote:

> On 10/1/06, James Edward Gray II <james / grayproductions.net> wrote:
>> On Oct 1, 2006, at 9:45 AM, Jim Menard wrote:
>>
>> > I believe the 48 hours are up, so here's my solution:
>> > http://www.io.com/~jimm/rubyquiz/quiz96/
>>
>> Dang that's clever Jim!
>>
>> Here's the tragedy.rb file I was taunting the list with yesterday:
>>
>> #!/usr/bin/env ruby -w
>>
>> class Array
>>    def rand
>>      fetch(Kernel.rand(size))
>>    end
>> end
>>
>> characters         = %w[James Ruby]
>> sentence_structure = [ "S falls in love with O.",
>>                         "S (slays|kills) O(.|.|.|!)",
>>                         "S cries." ]
>>
>> output = String.new
>> (ARGV.shift || 5).to_i.times do
>>    sentence = sentence_structure.rand.gsub(/\b[SO]\b/)
>> { characters.rand }
>>    output << "  " << sentence.gsub(/\([^()|]+(?:\|[^()|]+)+\)/) do |
>> choices|
>>      choices[1..-2].split("|").rand
>>    end
>> end
>>
>> puts output.strip.gsub(/(.{1,80}|\S{81,})(?: +|$\n?)/, "\\1\n")
>>
>> __END__
>
> I just get:
>
> jim.rb:17: odd number list for Hash
> something to do with the email formatting? I'll have to look later.

See if this version holds the formatting better and works for you:

http://pastie.caboo.se/15699

James Edward Gray II