Forum: Ruby Dice Roller

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3a5336a2844502fe58c2c06bc12c32ed?d=identicon&s=25 Stefan Walk (Guest)
on 2006-01-08 23:57
(Received via mailing list)
Hi, here is my solution... I don't know if it handles every case right,
but it was fun to write... ;)

By the way, does someone of you know what became of rockit
<http://rockit.sourceforge.net/> - it would've been very handy for this
quiz, but I could not get it to work somehow...

But here's the code:

class Integer;def d(v)r=0;times{r+=1+rand(v)};r;end;end;x,y=
$*;e=x.gsub('%',"100").gsub(/(^|\D|\))d/,'\\11d').gsub(/d(\d
*)/x){$1==""? ".d": ".d(#$1)"};puts ("1"..y).map{eval e}*" "

(Sorry... I just had to... ;))

Regards,
Stefan Walk
This topic is locked and can not be replied to.