Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

"roll 4d6 - L" is no longer showing results from dice.pm #198

Closed
sdball opened this issue Jun 19, 2013 · 4 comments
Closed

"roll 4d6 - L" is no longer showing results from dice.pm #198

sdball opened this issue Jun 19, 2013 · 4 comments
Labels

Comments

@sdball
Copy link
Collaborator

sdball commented Jun 19, 2013

Aww, one of my favorite goodies I worked on back in the day is no longer handling one of its special cases. The code for -L and -H is still in dice.pm but it must no longer be matching its execution pattern correctly.

The deal is to have the dice goodie respond to standard dice notation:

roll 4d6 - L # roll 4 six-sided die and subtract the lowest value
roll 3d12 - H # roll 3 twelve-sided die and subtract the highest value
@majuscule
Copy link
Collaborator

Hi @sdball!

Thanks for noting this issue. I've been taking a look at the the code, and I realized that the goodie has been case sensitive. The queries roll 4d6 - l and roll 3d12 - h do work. I've updated the goodie to trigger regardless of case - but it still doesn't seem to be doing quite what I expect. Since I am assuming it was working previously, and because I am unfamiliar with dice notation, I would appreciate you taking a second look checking the results.

Here's an example of what it's doing right now:

  You entered: roll 4d6 - L

DDG::ZeroClickInfo  {
    Parents       WWW::DuckDuckGo::ZeroClickInfo
    public methods (1) : new
    private methods (0)
    internals: {
        answer        "1 + 4 + 4 - 1 = 8 (random)",
        answer_type   "dice_roll",
        is_cached     0,
        is_unsafe     0
    }
}

That looks to me like 3 rolls, with the lowest subtracted, but I from what you've said, I would expect something like this (four rolls, minus the lowest):

  You entered: roll 4d6 - L

DDG::ZeroClickInfo  {
    Parents       WWW::DuckDuckGo::ZeroClickInfo
    public methods (1) : new
    private methods (0)
    internals: {
        answer        "1 + 4 + 4 + 3 - 1 = 11 (random)",
        answer_type   "dice_roll",
        is_cached     0,
        is_unsafe     0
    }
}

Can you confirm that in these cases we should be showing one more dice roll than we are? When you get back to me here, I'll make the fix, re-release and deploy.

Thanks!

@sdball
Copy link
Collaborator Author

sdball commented Aug 8, 2013

Sorry! I forgot that github doesn't email notifications anymore.

Yes, 4d6 - L says: roll 4 six-sided dice and subtract the lowest. That's definitely a bug. Instead of simply subtracting the lowest it should still be adding it and then subtracting it or just not even counting it.

roll 4d6 - l
5 + 5 + 6 - 3 = 13 (random) # should be 16
5 + 6 + 6 - 5 = 12 (random) # should be 17

@majuscule
Copy link
Collaborator

Hi again @sdball!

No problem :-) Although just to note - github does email me notifications. Perhaps it's a setting that's gotten disabled on your account?

Anyway, I see what you mean, and I've made the change in 21f4cbb. Additionally, I noticed that the way it was being done before was sorting the rolls before display. That didn't seem right to me, so I fixed that too. I also added a test case that should ensure that this error never comes up again.

Would you take a look and tell me what you think? If everything is right, I'll release the Goodies package and this will be deployed in a day or so.

Thanks again!

@majuscule
Copy link
Collaborator

Hi again,

It's been a while and this is now deployed. I'm closing the issue, but please feel free to reopen if you spot any other problems.

Thanks again!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants