Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Ruby (http://www.velocityreviews.com/forums/f66-ruby.html)
-   -   [SOLUTION] Dice Roller (http://www.velocityreviews.com/forums/t827609-solution-dice-roller.html)

Stefan Walk 01-08-2006 10:56 PM

[SOLUTION] Dice Roller
 
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





All times are GMT. The time now is 06:28 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.