[SOLUTION] Dice Roller

S

Stefan Walk

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top