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

Re: [pcgen-xml] Nested Prerequisites (Was: Examples)

Expand Messages
  • Keith Davies
    ... *Still* not right. That describes equals behavior, not no more than . if (minSet) { min = attribs.getAttrib( min ); } if (maxSet) { max =
    Message 1 of 29 , Apr 19, 2004
      On Mon, Apr 19, 2004 at 08:49:57AM -0700, Keith Davies wrote:
      > On Fri, Apr 16, 2004 at 06:46:32PM -0700, Jenni A. Merrifield wrote:
      > >
      > > > Still, I like the numbers version better -- it's a little clearer what's
      > > > going on and can be implemented using a single chain of logic:
      > > >
      > > > min = numChildren;
      > > > max = numChildren;
      > > > if (minSet) {
      > > > min = attribs.getAttrib( "min");
      > > > }
      > > > if (maxSet) {
      > > > max = attribs.getAttrib( "max");
      > > > }
      > > > childrenMatched = checkPrereqs( entity, children);
      > > > if ((min <= childrenMatched) &&
      > > > (childrenMatched <= max)) {
      > > > doWePassed();
      > > > } else {
      > > > doWeFailed();
      > > > }
      > > >
      > > > This does not require string examination of the operand attribute, nor
      > > > the logic necessary to handle the various cases.
      > >
      > > Your algorithmic argument is a fairly good one - the lack of a need
      > > to do string examination would probably make it somewhat more
      > > performant.
      >
      > It fails, though, if only max is set (oops). I need something like
      >
      > if (minSet) {
      > min = attribs.getAttrib( "min");
      > }
      > if (maxSet) {
      > max = attribs.getAttrib( "max");
      > if (!minSet) {
      > min = max;
      > }
      > }

      *Still* not right. That describes 'equals' behavior, not 'no more
      than'.

      if (minSet) {
      min = attribs.getAttrib( "min");
      }
      if (maxSet) {
      max = attribs.getAttrib( "max");
      if (!minSet) {
      min = 0;
      }
      }

      This one has it right. Finally.


      Keith
      --
      Keith Davies I gave my 2yo daughter a strawberry
      keith.davies@... Naomi: "Strawberry!"
      me: "What do you say?"
      Naomi: "*MY* strawberry!"
    • Frugal
      ... I have never seen you take so long to get something right, go away and take something for your cold ;O) I recommend a large
      Message 2 of 29 , Apr 20, 2004
        <quote who="Keith Davies">
        > On Mon, Apr 19, 2004 at 08:49:57AM -0700, Keith Davies wrote:
        >> On Fri, Apr 16, 2004 at 06:46:32PM -0700, Jenni A. Merrifield wrote:
        > *Still* not right. That describes 'equals' behavior, not 'no more
        > than'.
        >
        > if (minSet) {
        > min = attribs.getAttrib( "min");
        > }
        > if (maxSet) {
        > max = attribs.getAttrib( "max");
        > if (!minSet) {
        > min = 0;
        > }
        > }
        >
        > This one has it right. Finally.

        I have never seen you take so long to get something right, go away and
        take something for your cold ;O) I recommend a large whiskey with a hot
        lemon squeezed into it.

        --
        regards,
        Frugal
        -OS Chimp
      • Frugal
        ... I did ;O) ... I can go with this because it satisfies Frugals First Law Of Programming: Never Do Anything Twice. Well, it almost
        Message 3 of 29 , Apr 20, 2004
          <quote who="Keith Davies">
          > On Mon, Apr 19, 2004 at 07:13:18AM -0700, Jenni A. Merrifield wrote:
          >> <quote who="Frugal" when="Mon, 19 Apr 2004 09:04:47 +0100 (BST)"
          > I never called it a dogs dinner. I don't disagree, but someone else
          > said that.

          I did ;O)

          > Personally, I'd rather see
          >
          > <prereq kind='cumulative' min='20'>
          > <count kind='skill-ranks' key='skill.jump' />
          > <count kind='skill-ranks' key='skill.balance' />
          > <count kind='skill-ranks' key='skill.tumble' />
          > </prereq>
          >
          > If there are further requirements (such as 'each skill must have at
          > least four and no more than ten ranks') then treat those as separate
          > prereqs:
          >
          > <prereq kind='mult'>
          > <prereq kind='cumulative' min='20'>
          > <count kind='skill-ranks' key='skill.jump' />
          > <count kind='skill-ranks' key='skill.balance' />
          > <count kind='skill-ranks' key='skill.tumble' />
          > </prereq>
          > <prereq kind='skill-ranks' key='skill.jump' min='4' max='10' />
          > <prereq kind='skill-ranks' key='skill.balance' min='4' max='10' />
          > <prereq kind='skill-ranks' key='skill.tumble' min='4' max='10' />
          > </prereq>

          I can go with this because it satisfies Frugals First Law Of Programming:
          Never Do Anything Twice. Well, it almost does.

          <prereq kind='skill-ranks' key='skill.jump' min='4' max='10' />

          can also be written as:

          <prereq kind="cumulative" min="4" max="10">
          <count kind='skill-ranks' key='skill.jump' />
          </prereq>

          So rather than having to have <prereq kind="skill-ranks"/> and <count
          kind="skill-ranks" /> we can just have <count/> and express <prereq/> in
          terms of <count/>

          So the only <prereq> kinds we need are "count" and "mult" where
          kind="count" can only have <count> children and kind="mult" can only have
          <prereq> children.

          As we can convert from all <prereq kind="skill-ranks"/> to a count nested
          inside a prereq on the fly this should not be a problem.


          As an aside in the very low level schema I think that
          <count kind='skill-ranks' key='skill.jump' />
          should actually be written as:
          <count kind='var' key='skill.jump.ranks' />
          because we are storing a lot more of the information as variables than the
          current system

          --
          regards,
          Frugal
          -OS Chimp
        • Keith Davies
          ... The diet I m on, I m not allowed lemon. Or tea (my preferred cold-time drink is tea with honey (verboten) and a couple of Fisherman s Friends (strong
          Message 4 of 29 , Apr 20, 2004
            On Tue, Apr 20, 2004 at 08:33:36AM +0100, Frugal wrote:
            >
            > <quote who="Keith Davies">
            > > On Mon, Apr 19, 2004 at 08:49:57AM -0700, Keith Davies wrote:
            > >> On Fri, Apr 16, 2004 at 06:46:32PM -0700, Jenni A. Merrifield wrote:
            > > *Still* not right. That describes 'equals' behavior, not 'no more
            > > than'.
            > >
            > > if (minSet) {
            > > min = attribs.getAttrib( "min");
            > > }
            > > if (maxSet) {
            > > max = attribs.getAttrib( "max");
            > > if (!minSet) {
            > > min = 0;
            > > }
            > > }
            > >
            > > This one has it right. Finally.
            >
            > I have never seen you take so long to get something right, go away and
            > take something for your cold ;O) I recommend a large whiskey with a hot
            > lemon squeezed into it.

            The diet I'm on, I'm not allowed lemon. Or tea (my preferred cold-time
            drink is tea with honey (verboten) and a couple of Fisherman's Friends
            (strong cough tablet things)).

            The whiskey I am allowed, but I'm not much on whiskey.


            Keith
            --
            Keith Davies I gave my 2yo daughter a strawberry
            keith.davies@... Naomi: "Strawberry!"
            me: "What do you say?"
            Naomi: "*MY* strawberry!"
          • Keith Davies
            ... Yeah, I read your post after. ... Well, we probably need others because there are tests that are binary (such as kind= feat ), but I suspect a number of
            Message 5 of 29 , Apr 20, 2004
              On Tue, Apr 20, 2004 at 08:43:36AM +0100, Frugal wrote:
              > <quote who="Keith Davies">
              > > On Mon, Apr 19, 2004 at 07:13:18AM -0700, Jenni A. Merrifield wrote:
              > >> <quote who="Frugal" when="Mon, 19 Apr 2004 09:04:47 +0100 (BST)"
              > > I never called it a dogs dinner. I don't disagree, but someone else
              > > said that.
              >
              > I did ;O)

              Yeah, I read your post after.

              > > Personally, I'd rather see
              > >
              > > <prereq kind='cumulative' min='20'>
              > > <count kind='skill-ranks' key='skill.jump' />
              > > <count kind='skill-ranks' key='skill.balance' />
              > > <count kind='skill-ranks' key='skill.tumble' />
              > > </prereq>
              > >
              > > If there are further requirements (such as 'each skill must have at
              > > least four and no more than ten ranks') then treat those as separate
              > > prereqs:
              > >
              > > <prereq kind='mult'>
              > > <prereq kind='cumulative' min='20'>
              > > <count kind='skill-ranks' key='skill.jump' />
              > > <count kind='skill-ranks' key='skill.balance' />
              > > <count kind='skill-ranks' key='skill.tumble' />
              > > </prereq>
              > > <prereq kind='skill-ranks' key='skill.jump' min='4' max='10' />
              > > <prereq kind='skill-ranks' key='skill.balance' min='4' max='10' />
              > > <prereq kind='skill-ranks' key='skill.tumble' min='4' max='10' />
              > > </prereq>
              >
              > I can go with this because it satisfies Frugals First Law Of Programming:
              > Never Do Anything Twice. Well, it almost does.
              >
              > <prereq kind='skill-ranks' key='skill.jump' min='4' max='10' />
              >
              > can also be written as:
              >
              > <prereq kind="cumulative" min="4" max="10">
              > <count kind='skill-ranks' key='skill.jump' />
              > </prereq>
              >
              > So rather than having to have <prereq kind="skill-ranks"/> and <count
              > kind="skill-ranks" /> we can just have <count/> and express <prereq/> in
              > terms of <count/>
              >
              > So the only <prereq> kinds we need are "count" and "mult" where
              > kind="count" can only have <count> children and kind="mult" can only have
              > <prereq> children.

              Well, we probably need others because there are tests that are binary
              (such as kind='feat'), but I suspect a number of the numeric ones can be
              reduced to your example.

              OTOH, even feat can be:

              <prereq kind='count' min='1'>
              <count kind='feat' key='feat.alertness' />
              </prereq>

              OTOH, I can see someone getting hosed when they try to do

              <prereq kind='count' min='3'>
              <count kind='feat' key='feat.weapon-focus' />
              <count kind='feat' key='feat.greater-weapon-focus' />
              <cound kind='feat' key='feat.weapon-specialization' />
              </prereq>

              because it should be

              <prereq kind='mult'>
              <prereq kind='count' min='1'>
              <count kind='feat' key='feat.weapon-focus' />
              </prereq>
              <prereq kind='count' min='1'>
              <count kind='feat' key='feat.greater-weapon-focus' />
              </prereq>
              <prereq kind='count' min='1'>
              <count kind='feat' key='feat.weapon-specialization' />
              </prereq>
              </prereq>

              > As we can convert from all <prereq kind="skill-ranks"/> to a count
              > nested inside a prereq on the fly this should not be a problem.

              If this is reserved for internal use I don't think I'll argue, though I
              expect to keep the more concise form for external. While I agree that
              consistency is a benefit, I think I'd rather see the larger syntax used
              when needed, but allow the more concise syntax for the more common case.

              I don't like making *everything* harder in order accommodate something
              that I don't expect to come up often. OTOH, I really dislike special
              cases. Gah, I'm going to leave it for how.

              > As an aside in the very low level schema I think that
              > <count kind='skill-ranks' key='skill.jump' />
              > should actually be written as:
              > <count kind='var' key='skill.jump.ranks' />
              > because we are storing a lot more of the information as variables than the
              > current system

              Fair enough. IIRC at one point skill ranks were handled differently.


              Keith
              --
              Keith Davies I gave my 2yo daughter a strawberry
              keith.davies@... Naomi: "Strawberry!"
              me: "What do you say?"
              Naomi: "*MY* strawberry!"
            • Frugal
              ... Are you allowed Chilli? the other cure I have for a cold is a good hot curry. -- regards, Frugal -OS Chimp
              Message 6 of 29 , Apr 20, 2004
                <quote who="Keith Davies">
                > On Tue, Apr 20, 2004 at 08:33:36AM +0100, Frugal wrote:
                >> I have never seen you take so long to get something right, go away and
                >> take something for your cold ;O) I recommend a large whiskey with a hot
                >> lemon squeezed into it.
                >
                > The diet I'm on, I'm not allowed lemon. Or tea (my preferred cold-time
                > drink is tea with honey (verboten) and a couple of Fisherman's Friends
                > (strong cough tablet things)).
                >
                > The whiskey I am allowed, but I'm not much on whiskey.

                Are you allowed Chilli? the other cure I have for a cold is a good hot curry.

                --
                regards,
                Frugal
                -OS Chimp
              • Keith Davies
                ... Not really, no. Right now I m down to Vitamin C and hot water. I m at the worst part, the aw *shit*, I *am* sick part. Tomorrow I ll be in worse
                Message 7 of 29 , Apr 20, 2004
                  On Tue, Apr 20, 2004 at 03:35:25PM +0100, Frugal wrote:
                  >
                  > <quote who="Keith Davies">
                  > > On Tue, Apr 20, 2004 at 08:33:36AM +0100, Frugal wrote:
                  > >> I have never seen you take so long to get something right, go away and
                  > >> take something for your cold ;O) I recommend a large whiskey with a hot
                  > >> lemon squeezed into it.
                  > >
                  > > The diet I'm on, I'm not allowed lemon. Or tea (my preferred cold-time
                  > > drink is tea with honey (verboten) and a couple of Fisherman's Friends
                  > > (strong cough tablet things)).
                  > >
                  > > The whiskey I am allowed, but I'm not much on whiskey.
                  >
                  > Are you allowed Chilli? the other cure I have for a cold is a good hot
                  > curry.

                  Not really, no. Right now I'm down to Vitamin C and hot water.

                  I'm at the worst part, the 'aw *shit*, I *am* sick' part. Tomorrow I'll
                  be in worse condition, but it won't bother me so much because I'll
                  likely be unconscious anyway.


                  Keith
                  --
                  Keith Davies I gave my 2yo daughter a strawberry
                  keith.davies@... Naomi: "Strawberry!"
                  me: "What do you say?"
                  Naomi: "*MY* strawberry!"
                Your message has been successfully submitted and would be delivered to recipients shortly.