[RNG] Progressive difficulty

This is a discussion on [RNG] Progressive difficulty within the General Discussions forums, part of the Community Boards category; I'm planning to build a table of random special combat effects. Each group of 6 effects is more difficult to ...

  1. #1
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,510

    [RNG] Progressive difficulty

    I'm planning to build a table of random special combat effects. Each group of 6 effects is more difficult to achieve than the previous group.

    For now I came up with a simple system in which a 1d6 is rolled. Every time a 6 is rolled, I deduce 1 and sum up the result. I stop rolling when no 6 turns up. However, I need your help coming up with the correct formula to calculate the odds for any given number so I can correctly build the table.

    Example 1:
    1d6 = 5
    End result = 5

    Example 2:
    1d6 = 6
    1d6 = 3
    End Result: (6 - 1) + 3 = 8

    Example 3:
    1d6 = 6
    1d6 = 6
    1d6 = 2
    End Result: (6 - 1) + (6 - 1) + 2 = 12
    Last edited by Mario F.; 03-14-2010 at 07:54 PM.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  2. #2
    Registered User NeonBlack's Avatar
    Join Date
    Nov 2007
    Posts
    435
    Wouldn't it take you about 5 minutes just to do a simulation?
    I copied it from the last program in which I passed a parameter, which would have been pre-1989 I guess. - esbo

  3. #3
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,510
    Yes it would. But that wouldn't tell me the formula, now would it?
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  4. #4
    Registered User NeonBlack's Avatar
    Join Date
    Nov 2007
    Posts
    435
    Okay, I got bored. It looks like the formula is something like

    p(n)=(1/6)**floor((n+4)/5)
    I copied it from the last program in which I passed a parameter, which would have been pre-1989 I guess. - esbo

  5. #5
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,510
    Thanks Neon. I will try this later tomorrow. I'm busted now.
    One question though. Should I latter apply a d20, does the formula become (1/20)**floor((n+18)/19) ?
    Last edited by Mario F.; 03-14-2010 at 11:31 PM.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  6. #6
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Quote Originally Posted by Mario F. View Post
    Thanks Neon. I will try this later tomorrow. I'm busted now.
    One question though. Should I latter apply a d20, does the formula become (1/20)**floor((n+18)/19) ?
    Assuming you only keep rolling at a 20, yes.

  7. #7
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,510
    Dammit! This produces a very wide gap between groups of similar probabilities. I need this gap to lessen somewhat.

    Here's the results for numbers between 1 and 12 on a d6:

    1 = 16.67%
    2 = 16.67%
    3 = 16.67%
    4 = 16.67%
    5 = 16.67%
    6 = 2.78%
    7 = 2.78%
    8 = 2.78%
    9 = 2.78%
    10 = 2.78%
    11 = 0,46%
    12 = 0,46%

    Any ideas how I can manipulate the formula to lessen the gap?
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  8. #8
    Registered User NeonBlack's Avatar
    Join Date
    Nov 2007
    Posts
    435
    You could try doing something with two dice. Or give an extra roll to a six OR a five. What type of distribution are you trying to achieve?
    I copied it from the last program in which I passed a parameter, which would have been pre-1989 I guess. - esbo

  9. #9
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,510
    Only was able to get back to this tonight.

    What type of distribution are you trying to achieve?
    Nothing defined just yet. However I gave this a better look and indeed the current results are satisfying for my purposes. So this is pretty much solved.

    Thanks once again.
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 09-06-2009, 06:56 PM
  2. got difficulty on this
    By gtr_s15 in forum C++ Programming
    Replies: 4
    Last Post: 02-01-2006, 08:37 AM
  3. DVD Progressive Format
    By ober in forum Tech Board
    Replies: 5
    Last Post: 08-13-2004, 02:22 PM
  4. homework giving difficulty
    By jjj in forum C Programming
    Replies: 5
    Last Post: 09-13-2002, 06:35 PM
  5. Game difficulty
    By pdstatha in forum C++ Programming
    Replies: 5
    Last Post: 06-30-2002, 04:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21