From: Gregory Seidman Date: 2006-01-09T21:49:10+09:00 Subject: Re: [QUIZ.SOLUTION] Dice Roller (#61) We don't need no steenking leexer/parsers On Mon, Jan 09, 2006 at 03:57:20AM +0900, Paul Novak wrote: [...] } here is the Ruby: } } #!/usr/bin/env ruby } # } # roll.rb } # } } # fix up Fixnum to override ** with our desired d behavior } class Fixnum } def ** (sides) } # validation } if sides<1 } raise "Invalid sides value: '#{sides}', must be a positive Integer" } end } if self<1 } raise "Invalid number of rolls: '#{self}', must be a postitive Integer" } end } # roll the dice } (0..self).to_a.inject{|x,y| x + rand(sides)}+self I think I may be misunderstanding something here. You use 0..self, when I would think it would have to be either 0...self or 1..self to get the right number of rolls. Am I off? In my solution I used 1..self in much the same way. } end } end [...] --Greg