Post Reply 
Easy as { 1 2 3 }? (when { 1 2 3 } ≠ { 1 2 3 })
08-08-2018, 07:06 AM (This post was last modified: 08-08-2018 07:15 AM by pier4r.)
Post: #27
RE: Easy as { 1 2 3 }? (when { 1 2 3 } ≠ { 1 2 3 })
Thanks for the answer! And no I increment the list with get and put. No ListExt involved there if I am not mistaken. So I use the 2.15 RPL library.

I did a workaround knowing the amount of steps to do and making a loop instead of a comparison.

And thanks for the title change.

here is the code to increase the list (to get the position of the actual roll of X dice)
Code:

gpIncrDicePos
  \<<
    gvFalse "lvIsIncreased" DROP
    
    0 "lvPosToIncrease"   DROP
    
    \->
    lvIsIncreased
    lvPosToIncrease
    
    \<<
      gvDicePosActual SIZE 'lvPosToIncrease' STO
      
      WHILE
        lvIsIncreased NOT
        lvPosToIncrease 0 >
        AND
      REPEAT
        gvDicePosActual lvPosToIncrease GET
        IF
          @if the position to increase can be increased
          DUP
          gvDicePosMax lvPosToIncrease GET
          <
        THEN
          @then increase it
          1 + @increased value
          @prepare to put it in
          gvDicePosActual
          lvPosToIncrease
          ROT PUT 
          'gvDicePosActual' STO
          
          @said it is increased
          gvTrue 'lvIsIncreased' STO
        ELSE
          @delete the value on the stack
          DROP
          
          @put a 1 in the position as reset
          gvDicePosActual
          lvPosToIncrease
          1 PUT 'gvDicePosActual' STO
          
          @diminish the position to increase
          'lvPosToIncrease' 1 STO-
        END
      END
      
      IF
        lvPosToIncrease 0 \<=
      THEN
        @increased all the way through!
        @put to max
        gvDicePosMax 'gvDicePosActual' STO
      END
    \>>
  \>>

Wikis are great, Contribute :)
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Easy as { 1 2 3 }? - Joe Horn - 07-15-2018, 12:52 AM
RE: Easy as { 1 2 3 }? - DavidM - 07-15-2018, 01:41 AM
RE: Easy as { 1 2 3 }? - Joe Horn - 07-15-2018, 04:12 AM
RE: Easy as { 1 2 3 }? - DavidM - 07-15-2018, 04:52 AM
RE: Easy as { 1 2 3 }? - Claudio L. - 07-15-2018, 05:54 PM
RE: Easy as { 1 2 3 }? - DavidM - 07-15-2018, 06:07 PM
RE: Easy as { 1 2 3 }? - Claudio L. - 07-16-2018, 04:25 AM
RE: Easy as { 1 2 3 }? - DavidM - 07-17-2018, 03:05 AM
RE: Easy as { 1 2 3 }? - rprosperi - 07-17-2018, 03:26 AM
RE: Easy as { 1 2 3 }? - DavidM - 07-17-2018, 03:31 AM
RE: Easy as { 1 2 3 }? - Massimo Gnerucci - 07-17-2018, 06:33 AM
RE: Easy as { 1 2 3 }? - John Keith - 07-17-2018, 12:32 PM
RE: Easy as { 1 2 3 }? - Massimo Gnerucci - 07-17-2018, 02:11 PM
RE: Easy as { 1 2 3 }? - John Keith - 07-17-2018, 08:49 PM
RE: Easy as { 1 2 3 }? - John Keith - 07-15-2018, 01:01 PM
RE: Easy as { 1 2 3 }? - Dave Britten - 07-15-2018, 02:38 PM
RE: Easy as { 1 2 3 }? - DavidM - 07-15-2018, 05:21 PM
RE: Easy as { 1 2 3 }? - Eddie W. Shore - 07-17-2018, 12:43 PM
RE: Easy as { 1 2 3 }? - rprosperi - 07-17-2018, 01:06 PM
RE: Easy as { 1 2 3 }? - DavidM - 07-17-2018, 01:41 PM
RE: Easy as { 1 2 3 }? - John Keith - 07-17-2018, 08:42 PM
RE: Easy as { 1 2 3 }? - ttw - 07-17-2018, 04:00 PM
RE: Easy as { 1 2 3 }? - BartDB - 07-17-2018, 04:51 PM
RE: Easy as { 1 2 3 }? - pier4r - 08-07-2018, 04:07 PM
RE: Easy as { 1 2 3 }? (when { 1 2 3 } ≠ { 1 2 3 }) - pier4r - 08-08-2018 07:06 AM



User(s) browsing this thread: 2 Guest(s)