[SOLUTION] Dice Roller

Discussion in 'Ruby' started by Stefan Walk, Jan 8, 2006.

  1. Stefan Walk

    Stefan Walk Guest

    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
    Stefan Walk, Jan 8, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ruby Quiz

    [QUIZ] Dice Roller (#61)

    Ruby Quiz, Jan 6, 2006, in forum: Ruby
    Replies:
    106
    Views:
    859
    Morus Walter
    Jan 10, 2006
  2. Paul Novak
    Replies:
    2
    Views:
    127
    Joby Bednar
    Jan 10, 2006
  3. John Earles

    [SOLUTION] Dice Roller (#61)

    John Earles, Jan 8, 2006, in forum: Ruby
    Replies:
    0
    Views:
    146
    John Earles
    Jan 8, 2006
  4. Matthew Moss

    [QUIZ.SUMMARY] Dice Roller (#61)

    Matthew Moss, Jan 12, 2006, in forum: Ruby
    Replies:
    11
    Views:
    196
    J. Ryan Sobol
    Jan 13, 2006
  5. Hd Pwnz0r

    Dice Roller

    Hd Pwnz0r, Sep 7, 2010, in forum: Ruby
    Replies:
    7
    Views:
    241
    Josh Cheek
    Sep 7, 2010
Loading...

Share This Page