Skip to main content

Timeline for D&D dice rolling app

Current License: CC BY-SA 3.0

9 events
when toggle format what by license comment
Apr 13, 2015 at 23:00 comment added rolfl Correct, +80 is interpreted as 80d1 - or, 80 rolls of a 1-sided dice. Without the debug messages, this would compute is a minuscule amount of time... even in the 100's of thousands. You are right that this would be slower than an alternative special-case for no d in the spec, but that would ruin the elegance of the code ;-)
Apr 13, 2015 at 22:12 comment added IEatBagels It isn't super intuitive how you deal with +5 in 1d4+5. I understood by using the snippet though! If I happened to have 1d4+80, I'd go in an 80 iteration loop, isn't this a problem? (I didn't specify the input could be so big in my question, my bad)
Apr 13, 2015 at 21:36 comment added IEatBagels Why do you use /\+/ instead of '+'?
Apr 12, 2015 at 0:30 vote accept IEatBagels
Apr 11, 2015 at 14:49 comment added rolfl @200_success - in retrospect, I agree. I have revised that suggestion (removed it in fact). I have also: added a part about parseInt(), and additionally added a working stack snippet.
Apr 11, 2015 at 14:47 history edited rolfl CC BY-SA 3.0
add snippet - remove spec-clean, and add entry on parseInt.
Apr 11, 2015 at 7:15 comment added 200_success I agree with nearly everything, except spec.replace(/[^+0-9d]+/g, "") is too lenient and would lead to garbage input being processed as if it were legitimate.
Apr 11, 2015 at 7:13 history edited 200_success CC BY-SA 3.0
deleted 15 characters in body
Apr 11, 2015 at 4:23 history answered rolfl CC BY-SA 3.0