Loading ...
Sorry, an error occurred while loading the content.

Re: [pcgen] Add Common Stat Roll methods to gameModes

Expand Messages
  • Éric Beaudoin
    ... Ha coffee, let s do this again. We want a formula that has the same probabilistic result as the event rolling a d6 and re-rolling the d6 once if the result
    Message 1 of 22 , Oct 1, 2005
    • 0 Attachment
      At 14:01 2005.10.01, Éric Beaudoin wrote:
      >At 13:58 2005.10.01, Éric Beaudoin wrote:
      >>11/30 is not accurate (I need coffee). It should be 7/36. So if you drop the 1, you roll a d35 and divide the result by 7 and this is the same as rolling a d6 and re-rolling once if you get a one. So in rnd(35) return a random value in [ 0 .. 34 ], the dice expression would be floor(rnd(35)/7)+1.
      >
      >I really need that cooffee, I forgot to account the 1/36 to get the one and nothing pop up right. I'll try again later after my coffee.


      Ha coffee, let's do this again.

      We want a formula that has the same probabilistic result as the event rolling a d6 and re-rolling the d6 once if the result for the first roll is 1.

      The probability to get a result of 1 is 1/36. The probability to get any of the other result (2, 3, 4, 5 and 6) is 7/36.

      Let rnd(36) returns a random value that is >= 0 and < 36

      customroll() = floor((rnd(36)+6)/7)+1

      If we use d36 as a function that return a value that is >= 1 and <= 36, we have the following

      customroll() = floor((d36+5)/7)+1

      I think I got it this time. It's really easy so it makes you wonder what I was thinking earlier. Another proof that coffee is indeed a drug.

      Value of d36 Result
      ------------ ------
      1 1
      2 2
      3 2
      4 2
      5 2
      6 2
      7 2
      8 2
      9 3
      10 3
      11 3
      12 3
      13 3
      14 3
      15 3
      16 4
      17 4
      18 4
      19 4
      20 4
      21 4
      22 4
      23 5
      24 5
      25 5
      26 5
      27 5
      28 5
      29 5
      30 6
      31 6
      32 6
      33 6
      34 6
      35 6
      36 6


      -----------------------------------------------------------
      Éric "Space Monkey" Beaudoin
      Founding Member of the Hidden-in-the-Trench Club
      Release Monkey and Syntax Watchdog
      >> In space, no one can hear you sleep.
      >> Camels to can climb trees (and sometime eat them).
      <mailto:beaudoer@...>
    • Eddy Anthony
      ... If you keep dropping the 1 and reroll until it s not a 1 then that statistically amounts to 1d5+1 right? If you keep a 1 on the reroll then the odds get
      Message 2 of 22 , Oct 1, 2005
      • 0 Attachment
        David M. Bebber scribed:

        > I use a varient of the first method: 4d6, reroll ones, then drop lowest.
        > how would you code that?

        If you keep dropping the 1 and reroll until it's not a 1 then that
        statistically amounts to 1d5+1 right? If you keep a 1 on the reroll then the
        odds get complicated, I'm not sure how that would be formulated here.

        But, I don't know how integer additions fit into the syntax of this tag (or
        even if they do), I tried this:

        ROLLMETHOD:4d6, reroll ones, then drop lowest[tab]METHOD:roll(4,5+1,[2,3,4])

        And it seems to work. But maybe not, I changed it to
        METHOD:roll(4,5+10,[2,3,4]) just to see what I'd get, I expected results 30
        points above average but instead I got numbers from the teens on into the
        40's so I really don't know what this is doing.

        One thing I have noticed is that the preference window does not remember
        which one you have selected, every time you open the preferences the menu
        defaults to the first method encountered in the miscinfo.lst file which is
        somewhat inconvenient.
        --
        ~ Eddy Anthony (MoSaT)
        ~ PCGen Content Silverback
      • Éric Beaudoin
        ... METHOD appears to accept djep expressions. For example, the 3d6 is written simply 3d6. Is there anywhere we can find the full doc for djep or even just for
        Message 3 of 22 , Oct 1, 2005
        • 0 Attachment
          At 14:47 2005.10.01, Eddy Anthony wrote:
          >But, I don't know how integer additions fit into the syntax of this tag (or
          >even if they do), I tried this:
          >
          >ROLLMETHOD:4d6, reroll ones, then drop lowest[tab]METHOD:roll(4,5+1,[2,3,4])

          METHOD appears to accept djep expressions. For example, the 3d6 is written simply 3d6.

          Is there anywhere we can find the full doc for djep or even just for the roll function? My memory tells me that it is a modification of the standard jep parser but I don't remember if it was done in-house or if we got the code from somewhere. There is no license text for djep.jar in the lib folder.

          Anybody knows?


          -----------------------------------------------------------
          Éric "Space Monkey" Beaudoin
          Founding Member of the Hidden-in-the-Trench Club
          Release Monkey and Syntax Watchdog
          >> In space, no one can hear you sleep.
          >> Camels to can climb trees (and sometime eat them).
          <mailto:beaudoer@...>
        • Devon Jones
          ... it was contributed by one of our coders I think it was Ross Lodge. If it s useing djep, you can do all sorts of crazy stuff, even (1d2)d6 or 3d(1d4)+5
          Message 4 of 22 , Oct 1, 2005
          • 0 Attachment
            Éric Beaudoin wrote:

            >At 14:47 2005.10.01, Eddy Anthony wrote:
            >
            >
            >>But, I don't know how integer additions fit into the syntax of this tag (or
            >>even if they do), I tried this:
            >>
            >>ROLLMETHOD:4d6, reroll ones, then drop lowest[tab]METHOD:roll(4,5+1,[2,3,4])
            >>
            >>
            >
            >METHOD appears to accept djep expressions. For example, the 3d6 is written simply 3d6.
            >
            >Is there anywhere we can find the full doc for djep or even just for the roll function? My memory tells me that it is a modification of the standard jep parser but I don't remember if it was done in-house or if we got the code from somewhere. There is no license text for djep.jar in the lib folder.
            >
            >Anybody knows?
            >
            >
            >
            it was contributed by one of our coders I think it was Ross Lodge. If
            it's useing djep, you can do all sorts of crazy stuff, even (1d2)d6 or
            3d(1d4)+5

            it's pretty cool ;)

            Devon
          • Éric Beaudoin
            ... I ve look into the doc and I saw some of the coolness you describe but I can t find any reference to the roll() function. Any clue on this? Also, if it was
            Message 5 of 22 , Oct 1, 2005
            • 0 Attachment
              At 16:10 2005.10.01, Devon Jones wrote:
              >it was contributed by one of our coders I think it was Ross Lodge. If
              >it's useing djep, you can do all sorts of crazy stuff, even (1d2)d6 or
              >3d(1d4)+5
              >
              >it's pretty cool ;)
              >
              >Devon

              I've look into the doc and I saw some of the coolness you describe but I can't find any reference to the roll() function. Any clue on this?

              Also, if it was contributed by someone in the PCGen family, we should put out a license text for it and 1) recognize the contribution 2) give it a license that is compatible with the jep license if it is based on the jep source code. Do we have the source for djet BTW?


              -----------------------------------------------------------
              Éric "Space Monkey" Beaudoin
              Founding Member of the Hidden-in-the-Trench Club
              Release Monkey and Syntax Watchdog
              >> In space, no one can hear you sleep.
              >> Camels to can climb trees (and sometime eat them).
              <mailto:beaudoer@...>
            • Eddy Anthony
              ... I asked Greg Bingleman about this recently, he was able to pass me a couple ... This was for the KIT FUNDS tag which can do random starting gold, its about
              Message 6 of 22 , Oct 1, 2005
              • 0 Attachment
                Éric Beaudoin scribed:

                > I've look into the doc and I saw some of the coolness you describe but I can't
                > find any reference to the roll() function. Any clue on this?

                I asked Greg Bingleman about this recently, he was able to pass me a couple
                of examples:

                > Try QTY:roll("2d4")

                > HARP uses:
                > FUNDS:GP QTY:roll("10+1d10")

                This was for the KIT FUNDS tag which can do random starting gold, its about
                the only place in PCGen (besides the stat METHOD) where this would be
                useful right now because any other place you would use this in a formula
                PCGen would roll a new number every time you changed tabs.

                As always, its on my agenda to get this in the docs along with the random
                stat rolling stuff and all the other cool toys Greg's thrown in lately.
                --
                ~ Eddy Anthony (MoSaT)
                ~ PCGen Content Silverback
              • Éric Beaudoin
                ... Happy to ear that. If you point me to the code where the roll function is define, I m willing to try to see what it does. I don t write Java but I can read
                Message 7 of 22 , Oct 1, 2005
                • 0 Attachment
                  At 16:34 2005.10.01, Eddy Anthony wrote:
                  >Éric Beaudoin scribed:
                  >
                  >> I've look into the doc and I saw some of the coolness you describe but I can't
                  >> find any reference to the roll() function. Any clue on this?
                  >
                  >I asked Greg Bingleman about this recently, he was able to pass me a couple
                  >of examples:
                  >
                  >> Try QTY:roll("2d4")
                  >
                  >> HARP uses:
                  >> FUNDS:GP QTY:roll("10+1d10")
                  >
                  >This was for the KIT FUNDS tag which can do random starting gold, its about
                  >the only place in PCGen (besides the stat METHOD) where this would be
                  >useful right now because any other place you would use this in a formula
                  >PCGen would roll a new number every time you changed tabs.
                  >
                  >As always, its on my agenda to get this in the docs along with the random
                  >stat rolling stuff and all the other cool toys Greg's thrown in lately.

                  Happy to ear that.

                  If you point me to the code where the roll function is define, I'm willing to try to see what it does. I don't write Java but I can read it sometimes :-).

                  In this case, I'm very interested to find out how I could make PCGen use (roll) a dice expression a number of time and keep the x greatest (or lowest) rolls out of n. This is what is needed to implement the funky house-rules methods that some users (including me) use.


                  -----------------------------------------------------------
                  Éric "Space Monkey" Beaudoin
                  Founding Member of the Hidden-in-the-Trench Club
                  Release Monkey and Syntax Watchdog
                  >> In space, no one can hear you sleep.
                  >> Camels to can climb trees (and sometime eat them).
                  <mailto:beaudoer@...>
                • Eddy Anthony
                  ... Ask Greg, I can t even read it. ... Me too, me know what you learn and I ll include it in the doc entry. -- ~ Eddy Anthony (MoSaT) ~ PCGen Content
                  Message 8 of 22 , Oct 1, 2005
                  • 0 Attachment
                    Éric Beaudoin scribed:

                    > If you point me to the code where the roll function is define, I'm willing to
                    > try to see what it does. I don't write Java but I can read it sometimes :-).


                    Ask Greg, I can't even read it.

                    > In this case, I'm very interested to find out how I could make PCGen use
                    > (roll) a dice expression a number of time and keep the x greatest (or lowest)
                    > rolls out of n. This is what is needed to implement the funky house-rules
                    > methods that some users (including me) use.

                    Me too, me know what you learn and I'll include it in the doc entry.
                    --
                    ~ Eddy Anthony (MoSaT)
                    ~ PCGen Content Silverback
                  • Devon Jones
                    ... Yes, the source is *inside* the jar ;) Devon
                    Message 9 of 22 , Oct 1, 2005
                    • 0 Attachment
                      Éric Beaudoin wrote:

                      >At 16:10 2005.10.01, Devon Jones wrote:
                      >
                      >
                      >>it was contributed by one of our coders I think it was Ross Lodge. If
                      >>it's useing djep, you can do all sorts of crazy stuff, even (1d2)d6 or
                      >>3d(1d4)+5
                      >>
                      >>it's pretty cool ;)
                      >>
                      >>Devon
                      >>
                      >>
                      >
                      >I've look into the doc and I saw some of the coolness you describe but I can't find any reference to the roll() function. Any clue on this?
                      >
                      >Also, if it was contributed by someone in the PCGen family, we should put out a license text for it and 1) recognize the contribution 2) give it a license that is compatible with the jep license if it is based on the jep source code. Do we have the source for djet BTW?
                      >
                      >
                      >
                      >
                      Yes, the source is *inside* the jar ;)

                      Devon
                    • Éric Beaudoin
                      ... Let s pretend for a second that the only thing I know about the .jar file generation is that I have to type ant clean build test when I want to build the
                      Message 10 of 22 , Oct 1, 2005
                      • 0 Attachment
                        At 17:28 2005.10.01, Devon Jones wrote:
                        >>Also, if it was contributed by someone in the PCGen family, we should put out a license text for it and 1) recognize the contribution 2) give it a license that is compatible with the jep license if it is based on the jep source code. Do we have the source for djet BTW?
                        >>
                        >>
                        >>
                        >>
                        >Yes, the source is *inside* the jar ;)
                        >
                        >Devon

                        Let's pretend for a second that the only thing I know about the .jar file generation is that I have to type "ant clean build test" when I want to build the PCGen .jar files. How can I get the source out of a .jar that I do not compile myself?


                        -----------------------------------------------------------
                        Éric "Space Monkey" Beaudoin
                        Founding Member of the Hidden-in-the-Trench Club
                        Release Monkey and Syntax Watchdog
                        >> In space, no one can hear you sleep.
                        >> Camels to can climb trees (and sometime eat them).
                        <mailto:beaudoer@...>
                      • Byngl
                        The file you want is src/java/pcgen/util/PJEP.java Do a search for: 10+d10 That ll get you to the definition of the function, but won t be entirely helpful.
                        Message 11 of 22 , Oct 1, 2005
                        • 0 Attachment
                          The file you want is src/java/pcgen/util/PJEP.java
                          Do a search for: 10+d10

                          That'll get you to the definition of the function, but won't be
                          entirely helpful. What you need to look at is
                          src/java/pcgen/util/DiceExpression.jj. This file defines the grammar
                          used to parse the dice expressions. It gets run through javaCC (Java
                          Compiler Compiler). The .jj file is credited to binkley, so if you'd
                          like more info, he'd be the one to contact.

                          Byngl

                          --- In pcgen@yahoogroups.com, Eddy Anthony <eddyba@m...> wrote:
                          > Éric Beaudoin scribed:
                          >
                          > > If you point me to the code where the roll function is define,
                          I'm willing to
                          > > try to see what it does. I don't write Java but I can read it
                          sometimes :-).
                          >
                          >
                          > Ask Greg, I can't even read it.
                          >
                          > > In this case, I'm very interested to find out how I could make
                          PCGen use
                          > > (roll) a dice expression a number of time and keep the x greatest
                          (or lowest)
                          > > rolls out of n. This is what is needed to implement the funky
                          house-rules
                          > > methods that some users (including me) use.
                          >
                          > Me too, me know what you learn and I'll include it in the doc entry.
                          > --
                          > ~ Eddy Anthony (MoSaT)
                          > ~ PCGen Content Silverback
                        • Éric Beaudoin
                          ... Here s what I can tell about the roll function: We can invoke the function multiple ways. What the function do is based on the number and type of the
                          Message 12 of 22 , Oct 1, 2005
                          • 0 Attachment
                            At 19:01 2005.10.01, Byngl wrote:
                            >That'll get you to the definition of the function, but won't be
                            >entirely helpful. What you need to look at is
                            >src/java/pcgen/util/DiceExpression.jj. This file defines the grammar
                            >used to parse the dice expressions. It gets run through javaCC (Java
                            >Compiler Compiler). The .jj file is credited to binkley, so if you'd
                            >like more info, he'd be the one to contact.
                            >
                            >Byngl

                            Here's what I can tell about the roll function:

                            We can invoke the function multiple ways. What the function do is based on the number and type of the parameters.

                            The type can be integer, array of integer or string.

                            The roll functions appear to be all defined in \src\java\pcgen\util\DiceExpressionFunctions.java and they all call RollingMethods.roll in \src\java\pcgen\core\RollingMethods.java

                            When using the roll function, numbers are treated as integer, list of coma separate integer enclosed in [] are treated as array of integers, characters enclosed in "" are treated as strings. I do not know for sure how a string without the "" is interpreted but I think the parser somehow tries to convert it to integer before feed the functions (e.g.. 3d6 without the "" would be seen as 3 or 6 or 36, 5+1 would probably be 6).

                            The possible ways to call the roll functions are:

                            General note: all the roll function returns the total of all rolls performed

                            roll(times,sides) times => integer, number of time to roll
                            sides => integer, type of dice to roll
                            e.g. roll(3,6) == 3d6

                            roll(sides) sides => integer, type of dice to roll
                            e.g. roll(6) == 1d6
                            note: this is one form that do not call
                            RollingMethods.roll but call Globals.getRandomInt
                            directly instead

                            roll(times,sides,[keep])
                            times => integer, number of time to roll
                            sides => integer, type of dice to roll
                            [keep] => array of integer, index of the dice
                            we want to keep. The dices are sorted
                            from the lower result (index = 1) to
                            the largest result (index = times)
                            e.g. roll(4,6,[2,3,4]) == 4d6, keep the three best

                            roll(times,[sides]) times => integer, number of time to roll
                            [sides] => array of integer, possible dice to choose
                            from randomly
                            e.g. roll(4,[4,6]) == roll four times, each time you
                            randomly choose a d4 or a d6
                            note: this is one form that do not call
                            RollingMethods.roll but call Globals.getRandomInt
                            directly instead.
                            Whoever code this called it bizarre dice
                            rolling with good reason.

                            roll(times,[sides],[keep])
                            times => integer, number of time to roll
                            [sides] => array of integer, possible dice to choose
                            [keep] => array of integer, index of the dice
                            we want to keep. The dices are sorted
                            from the lower result (index = 1) to
                            the largest result (index = times)
                            e.g. roll(4,[4,6],[3,4])
                            == roll four times, each time you randomly
                            choose a d4 or a d6, and you keep only the
                            two best results
                            note: this is one form that do not call
                            RollingMethods.roll but call Globals.getRandomInt
                            directly instead.
                            Whoever code this called it bizarre dice
                            rolling with good reason.

                            roll("djep") "djep" => string, djep expression that gets fed to the
                            djep parser
                            e.g. roll("3d6") == 3d6

                            And the last but certainly not the least clear

                            roll(times,sides,modifier,keep,reroll_value)
                            times => integer, number of time to roll
                            sides => integer, type of dice to roll
                            modifier => integer, value that gets added to the total
                            after all the rolls are done
                            keep => integer, number of dices to keep, the lower
                            values are dropped
                            reroll_value => integer, if the result is not greater
                            then reroll_value, roll again (multiple
                            times is necessary)
                            e.g. roll(4,6,10,3,2)
                            == roll 4d6, reroll any 1 or 2, keep the 3
                            highest values, and add 10 to the total

                            Well, this is a bit ugly and it doesn't allow us to do everything we need. So I ask for three FREQ.

                            1) Please, put all the existing way to call roll in the documentation before we
                            forget. I really don't want to do this again (my nose is bleeding!)

                            2) Two new form of rolls (really, we don't nearly have enough of them)

                            roll(times,"djep")
                            roll(times,"djep",[keep])
                            times => integer, number of time to roll
                            "djep" => string, djep expression that gets fed to the
                            djep parser
                            [keep] => array of integer, index of the dice
                            we want to keep. The dices are sorted
                            from the lower result (index = 1) to
                            the largest result (index = times)
                            e.g. roll(3,"1d5+1") == evaluate the djep expression
                            1d5+1 three times and return the total
                            e.g. roll(4,"1d5+1",[2,3,4])
                            == evaluate the djep expression 1d5+1 four
                            times and return the sum of the three
                            highest values

                            maybe roll(times,"djep",keep) could also be done
                            times => integer, number of time to roll
                            "djep" => string, djep expression that gets fed to the
                            djep parser
                            keep => integer, number of dices to keep, the lower
                            values are dropped
                            e.g. roll(4,"1d5+1",3)
                            == evaluate the djep expression 1d5+1 four
                            times and keep the three highest values

                            I'm not sure though since it add complexity and if we have to choose, I prefer we keep the more versatile [keep] version. I think we should be OK with only three form that use "djep".

                            3) We deprecate all the forms that do not use djep. Let's face it, roll("3d6")
                            or roll(3,"d6") are way clearer then roll(3,6). The djep expressions allow
                            us to do way more.

                            Well, that's about it.

                            -----------------------------------------------------------
                            Éric "Space Monkey" Beaudoin
                            Founding Member of the Hidden-in-the-Trench Club
                            Release Monkey and Syntax Watchdog
                            >> In space, no one can hear you sleep.
                            >> Camels to can climb trees (and sometime eat them).
                            <mailto:beaudoer@...>
                          • Devon Jones
                            ... Oh, heh :) It s a zip file. just rename it to .zip, and you can open it with your favorite zip tool (or, if you use a command line program, you don t even
                            Message 13 of 22 , Oct 2, 2005
                            • 0 Attachment
                              Éric Beaudoin wrote:

                              >At 17:28 2005.10.01, Devon Jones wrote:
                              >
                              >
                              >>>Also, if it was contributed by someone in the PCGen family, we should put out a license text for it and 1) recognize the contribution 2) give it a license that is compatible with the jep license if it is based on the jep source code. Do we have the source for djet BTW?
                              >>>
                              >>>
                              >>>
                              >>>
                              >>>
                              >>>
                              >>Yes, the source is *inside* the jar ;)
                              >>
                              >>Devon
                              >>
                              >>
                              >
                              >Let's pretend for a second that the only thing I know about the .jar file generation is that I have to type "ant clean build test" when I want to build the PCGen .jar files. How can I get the source out of a .jar that I do not compile myself?
                              >
                              >
                              >
                              Oh, heh :) It's a zip file. just rename it to .zip, and you can open it
                              with your favorite zip tool (or, if you use a command line program, you
                              don't even need to rename it to .zip for many of them).

                              Devon
                            Your message has been successfully submitted and would be delivered to recipients shortly.