Results 1 to 19 of 19

Thread: (Simple?) Math Problem     submit to reddit submit to twitter

  1. #1
    Salvage Bans
    Join Date
    Apr 2006
    Posts
    763
    BG Level
    5
    FFXI Server
    Lakshmi

    (Simple?) Math Problem

    So, i'm working on a stat distribution script for an RPG i'm making, and I'm trying to find out a number.

    Let's say, each time you spend a stat point into HP, it's going to increase by 30. You can increase your HP up to a maximum of 500 times (therefore 15000 total, right?)

    However, I want it so that for each time you increase, the value goes up by 2. So, instead of (30, 30, 30, 30...) I want it to be (30, 32, 34, 36...) but I don't know how to find that number, without manually adding it 500 times.

    The script is working fine and all, I just want to be able to plug in a new maximum number to be able to find out just how much HP they are able to get if fully maxed out.

    Hopefully some math gurus will wanna take a stab at this, thanks for the help.

  2. #2
    Sandworm Swallows
    Join Date
    Dec 2007
    Posts
    7,108
    BG Level
    8

    Why don't you just add a counter in the upgrade script to stop at 500 upgrades instead of using a static number?

  3. #3
    Banned.

    Join Date
    Aug 2010
    Posts
    121
    BG Level
    3

    X = 30; Initialize
    BaseStat = 10; (or whatever your base stat is).

    Upgrade loop:
    BaseStat = BaseStat + X;
    X = X +2;

  4. #4
    Sandworm Swallows
    Join Date
    Dec 2007
    Posts
    7,108
    BG Level
    8

    265498 is what this program i wrote real fast gave me, check my work!

    Dim counter As Double
    Dim add As Double

    counter = 0
    add = 0

    Do Until counter = 500
    counter = counter + 1
    If counter = 1 Then
    add = add + 30
    Else
    add = add + 30
    add = add + (2 * counter)
    End If


    Loop

    MsgBox(add)

  5. #5
    Old Merits
    Join Date
    Feb 2008
    Posts
    1,033
    BG Level
    6
    FFXI Server
    Phoenix

    Quote Originally Posted by Datonare View Post

    but I don't know how to find that number, without manually adding it 500 times.
    500x30 + 500x2(1000, average of 250*2, 500) increase, should be 15000 + (500raises* avg up of 500) 250000 = 265000?

    some wild silly head math, probably won't make sense to anyone else but me.

    or just 30 minimum, 1030 max? 530 avg * 500ups, for 265,000. abit clearer

  6. #6
    MOST RAD.
    Join Date
    Oct 2007
    Posts
    1,665
    BG Level
    6
    FFXIV Character
    Pupuru Puru
    FFXIV Server
    Goblin
    FFXI Server
    Ragnarok

    It's a summation. 30 + 2(i-1) for i = 1 to 500.

    265,500 if I did it right.

  7. #7
    Salvage Bans
    Join Date
    Apr 2006
    Posts
    763
    BG Level
    5
    FFXI Server
    Lakshmi

    You were right, Chen lol. With the help of Maxwell's formula I was able to write a basic loop and found out it was 264750 (250 base HP). That is absurdly way too much, so now I know to adjust it. Thanks for the help everyone

  8. #8
    assburgers
    Join Date
    Mar 2007
    Posts
    10,925
    BG Level
    9

    Ah, Gauss was known for doing a problem like this involving summed arithmetic sequences.
    His was in class, teacher asked the kids to add 1+2+3+...+99+100, he worked it out "too quickly" for her taste, according to the little blurb in my book upstairs.

    The nth member, (in this case the 500th member) of the sequence starting from a_1 (32), and increasing by d (2), is a_n = 32 + ((500-1)*2), so a_n = 1030

    We can then sum it since...

    (a_1 + d) + (a_1 + 2d) + ... + (a_1 + (n - 2)d) + (a_1 + (n - 1)d)
    is the same as
    (a_n - (n-1)d) + (a_n - (n-2)d) + ... + (a_n - 2d) + (a_n - d) + a_n

    You can add both sides, and get twice the sum of your sequence 2S_n = n(a_1 + a_n), or S_n = (n/2)(a_1 + a_n)

    S_n =(500/2)*(32+1030)
    S_n = 250*1062
    S_n = 265,500


    Fun problems to play with, like sliding around puzzle pieces.

  9. #9
    Sandworm Swallows
    Join Date
    Dec 2007
    Posts
    7,108
    BG Level
    8

    I guess my program was off because it didn't start the increase until the second time around.

  10. #10
    BG Content
    Join Date
    Jul 2007
    Posts
    22,360
    BG Level
    10
    FFXI Server
    Lakshmi
    Blog Entries
    1

    Quote Originally Posted by Datonare View Post
    So, i'm working on a stat distribution script for an RPG i'm making, and I'm trying to find out a number.

    Let's say, each time you spend a stat point into HP, it's going to increase by 30. You can increase your HP up to a maximum of 500 times (therefore 15000 total, right?)

    However, I want it so that for each time you increase, the value goes up by 2. So, instead of (30, 30, 30, 30...) I want it to be (30, 32, 34, 36...) but I don't know how to find that number, without manually adding it 500 times.

    The script is working fine and all, I just want to be able to plug in a new maximum number to be able to find out just how much HP they are able to get if fully maxed out.

    Hopefully some math gurus will wanna take a stab at this, thanks for the help.
    {30, 32, 34, 36, ... , 28+n*2} (n goes from 1 to an upper limit X)
    Base + SUM{30, 32, 34, 36, ... , 28+n*2} = Current max HP
    Base + {(28+2*1) + (28+2*2) + (28+2*3)... + (28+2*n)} = Base + 28*n + {2*1 + 2*2 + 2*3 + 2*4 ... + 2*n}
    = Base + 28*n + 2*{1+2+3+4+5+...n}

    So what you need to do is establish a rule that tells you the sum of that sequence up to n.

    If n = 5: 1+2+3+4+5 = 15
    If n = 6: 1+2+3+4+5+6 = 21
    if n = 7: 1+2+3+4+5+6+7 = 28
    If n = 8: ... +8 = 36
    If n = 9: ... +9 = 45
    If n = 10: ... +10 = 55
    If n = 11: ... +11 = 66
    If n = 12: ... +12 = 78
    If n = 13: ... +13 = 91
    If n = 14: ... +14 = 105

    15/5 = 3
    21/6 = 3.5
    28/7 = 4
    36/8 = 4.5
    45/9 = 5
    55/10 = 5.5
    66/11 = 6
    .
    .
    .
    etc,

    n*(n/2+.5) = n*((n+1)/2) = the sum of the series up to n, I'd bet


    So the general formula you'd want is:

    HP = Base + 28*n + 2*n*((n+1)/2)

    Simplified further:
    HP = Base + 28*n + n*(n+1) = Base + n*(29+n)


    PS. Sorry, I just like playing with math problems. I didn't read the other responses, but they were probably right too.


    Double edit:
    Dato, if you're creating this system for stat distribution where you give people a limited number of points to spend per level (say 5) and they have to distribute them as they see fit, there are a few reasonable options.
    * First, you could set a cap on categories that's lower than the number of points attainable (set cap at, say, 100). I don't really like this method, as it limits the possibilities for players and increases the odds they'll cap out multiple stats.
    * Depending on your system, it may be fine to have people that have entirely ridiculous amounts of one stat, if it means they're sacrificing all stats that would make them useful. For instance, you could make it so a melee with 200,000 HP and 30 STR would hit for 0 against endgame monsters. Or so a tank with 200,000HP and 30 VIT would get hit for 20,000 per swing while one with 100,000HP and 80 VIT would get hit for 5,000 per swing. Make sure each job is dependent upon at least three stats to be functional and people HP whoring won't be an issue because it's not even a remotely responsible option. Still, depending what HP total you're aiming for you may want to add only 1 HP (or less and floor it) per increase. I do like that idea though, increasing returns with increasing commitment to a stat. It encourages specialization.
    * You could have "job" and "abilities" be defined by the stat assignment rather than some pre-determined designation. So if you have someone who puts 50 points into VIT, maybe they get Cover and an Enmity bonus. If someone puts 50 points into Strength, maybe they get Double Attack. Then you end up with a system somewhat like FFXI's subjob system. Everyone is going to commit to one main role, but it will probably benefit them to invest a minimal number of skill points to obtain low level JAs of other disciplines, for instance if Provoke was obtained at 10 STR. This would also limit the drive for higher role specific stats. You could just not grant new job abilities for commitments over, say, 100 stat points. That way it's not capped (like in option 1) but there's a disincentive because you could be using those points to unlock other potentially useful low level JAs/JTs.
    * Another example would be Advanced jobs. Say that Cure access is MND based. If you had 500 points and wanted to make a Tank, it would be useful to max out HP and Damage-, then put points into MND to get low level Cure access and make yourself a Paladin. You could make "advanced jobs" a naturally evolving part of your system. The advantages of designing your system this way are: 1) Every character uses the same code. You don't have the Paladin code and stats and the Warrior code and stats. You have have Stats, and the ~10 numbers that represent the character's stat progression determine everything about them. One code, one system, less work. 2) It's entirely customizable and gives a lot of freedom. 3) It requires some skill and foresight to plan character development, which would make it very fun to play if the difficulty level is high enough.

  11. #11
    Salvage Bans
    Join Date
    Apr 2006
    Posts
    763
    BG Level
    5
    FFXI Server
    Lakshmi

    Wow, Byrthnoth, thanks for the reply.

    Currently there are 4 characters and they each have identical base stats (but very slight differences in how quickly stats can be raised), as I didn't want to say "btw, this character better be an xxxx or they will suck" so I want to give the player the freedom to build each character the way they want. I really like the whole "Get x of this stat to boost x". As it stands right now, there are 7 classes to choose from. Changing to a class doesn't affect your stats in any way, just the skills you have (or potentially have access to) as well as the type of armor/weapons you can equip. You gain skills by leveling up that class (class level and character level are separate, stat points are awarded on character level only.) However, if you played one character as a mage, but wanted to switch over to say a warrior type class, I'm giving each class different attacks that both utilize intelligence for damage as well as strength, so to make cross classing easier.

    Another way to learn skills is through equipping gear (similar to FF9 if you've played it.) Gear also increases stats, so there's really a large way to boost your character's stats. Oh, and there's passive skills too, which further customizes your character and the way you want them to be played.

    Finally, you have a limited number of "points" that you use to equip skills with (certain pieces of gear can raise this limit though.) There are a few games that had this kind of system, I just can't think of any off the top of my head atm. So, you will have to balance how many active and passive skills you want to use, etc.

    Okay, better stop ranting... I don't get a lot of input/discussion on my work so I kinda started to blabber. @.@

  12. #12
    Banned.

    Join Date
    Jan 2008
    Posts
    4,736
    BG Level
    7

    Quote Originally Posted by Max™ View Post
    Ah, Gauss was known for doing a problem like this involving summed arithmetic sequences.
    His was in class, teacher asked the kids to add 1+2+3+...+99+100, he worked it out "too quickly" for her taste, according to the little blurb in my book upstairs.

    The nth member, (in this case the 500th member) of the sequence starting from a_1 (32), and increasing by d (2), is a_n = 32 + ((500-1)*2), so a_n = 1030

    We can then sum it since...

    (a_1 + d) + (a_1 + 2d) + ... + (a_1 + (n - 2)d) + (a_1 + (n - 1)d)
    is the same as
    (a_n - (n-1)d) + (a_n - (n-2)d) + ... + (a_n - 2d) + (a_n - d) + a_n

    You can add both sides, and get twice the sum of your sequence 2S_n = n(a_1 + a_n), or S_n = (n/2)(a_1 + a_n)

    S_n =(500/2)*(32+1030)
    S_n = 250*1062
    S_n = 265,500


    Fun problems to play with, like sliding around puzzle pieces.
    lol, copypasta without answering the question. no shame at all. like a fuckin retarded ass boss.

  13. #13
    BG Content
    Join Date
    Jul 2007
    Posts
    22,360
    BG Level
    10
    FFXI Server
    Lakshmi
    Blog Entries
    1

    Quote Originally Posted by Datonare View Post
    Wow, Byrthnoth, thanks for the reply.

    Currently there are 4 characters and they each have identical base stats (but very slight differences in how quickly stats can be raised), as I didn't want to say "btw, this character better be an xxxx or they will suck" so I want to give the player the freedom to build each character the way they want. I really like the whole "Get x of this stat to boost x". As it stands right now, there are 7 classes to choose from. Changing to a class doesn't affect your stats in any way, just the skills you have (or potentially have access to) as well as the type of armor/weapons you can equip. You gain skills by leveling up that class (class level and character level are separate, stat points are awarded on character level only.) However, if you played one character as a mage, but wanted to switch over to say a warrior type class, I'm giving each class different attacks that both utilize intelligence for damage as well as strength, so to make cross classing easier.

    Another way to learn skills is through equipping gear (similar to FF9 if you've played it.) Gear also increases stats, so there's really a large way to boost your character's stats. Oh, and there's passive skills too, which further customizes your character and the way you want them to be played.

    Finally, you have a limited number of "points" that you use to equip skills with (certain pieces of gear can raise this limit though.) There are a few games that had this kind of system, I just can't think of any off the top of my head atm. So, you will have to balance how many active and passive skills you want to use, etc.

    Okay, better stop ranting... I don't get a lot of input/discussion on my work so I kinda started to blabber. @.@
    Haha, that sounds like a cool and very customizable system. How are you coding this, RMKR? I'd be willing to beta it for you if I can get it to run.

    I started making one with 2k3 ages ago, but I'm no artist and I was frustrated with how limited my options for graphics were, whatever was and I could find ended up dictating what I'd use, and it was affecting the story. Thus, I quit.

  14. #14
    Salvage Bans
    Join Date
    Apr 2006
    Posts
    763
    BG Level
    5
    FFXI Server
    Lakshmi

    I'm using RMVX at the moment. In terms of graphics quality, it's a lot better than XP, but I'm not too fond of how the chipsets work, it's tough making multi-level terrains, like a mountain. So, I am kind of limited as to how "cool" I can make my game look, but what it may lack in style, I hope to make up for in fun and vast game play.

    And I would definitely be up for you trying out a beta and giving me feedback; that's one resource I don't have. In fact, the game I am working on now is the second one in my series, the first one is about 8-12 hours long depending on how much side content you do. I'm just very self conscious with my work so I only released it to my close friends and wife to play (of course they told me they liked it lol) The first one also doesn't have a lot of customization and such, as it's more of a story-based RPG... basically an introduction for the second one, which I plan to make longer and more in-depth.

    As for the 2nd game, I've been working on it a lot lately and should have a small build ready to go within a few days. It would only be 3 hours long or so, but it would include most, if not all of the features I plan to have in the full version.

  15. #15
    assburgers
    Join Date
    Mar 2007
    Posts
    10,925
    BG Level
    9

    Quote Originally Posted by The Finesse View Post
    lol, copypasta without answering the question. no shame at all. like a fuckin retarded ass boss.
    Indeed, I copied it (an extremely generic problem regarding summing sequences) out of a book I had upstairs, punched in the numbers he requested, and used my calculator to check figures. He seemed to be asking how to figure out something which reminded me of Gauss's rather famous problem, would you like me to post a picture of the book with my dick on the page and some random phrase of your choice to prove I have books I read?

    Tough, I don't have a webcam that'll work, will this be close enough:
    http://www.prometheusbooks.com/image...%20Lessons.jpg
    +
    http://forumpolitics.com/pics/dick-cheney.jpg
    ???

  16. #16
    BG Content
    Join Date
    Jul 2007
    Posts
    22,360
    BG Level
    10
    FFXI Server
    Lakshmi
    Blog Entries
    1

    Quote Originally Posted by Datonare View Post
    I'm using RMVX at the moment. In terms of graphics quality, it's a lot better than XP, but I'm not too fond of how the chipsets work, it's tough making multi-level terrains, like a mountain. So, I am kind of limited as to how "cool" I can make my game look, but what it may lack in style, I hope to make up for in fun and vast game play.

    And I would definitely be up for you trying out a beta and giving me feedback; that's one resource I don't have. In fact, the game I am working on now is the second one in my series, the first one is about 8-12 hours long depending on how much side content you do. I'm just very self conscious with my work so I only released it to my close friends and wife to play (of course they told me they liked it lol) The first one also doesn't have a lot of customization and such, as it's more of a story-based RPG... basically an introduction for the second one, which I plan to make longer and more in-depth.

    As for the 2nd game, I've been working on it a lot lately and should have a small build ready to go within a few days. It would only be 3 hours long or so, but it would include most, if not all of the features I plan to have in the full version.
    Well, (I don't know how much you remember of me) but I am an overly honest jackass! I will tell you with the greatest degree of frankness how very pleasant your game was to play.

    Now then, another factor in my departure from RM2k3 was my lack of a PC. I suppose RMVX still requires a PC? I anticipate getting one within the next two weeks, but I don't have one yet. 2004 PowerPC Mac onry.

    Also, when I talked about graphics I basically meant my ability and willingness to make chipsets of my own.

  17. #17
    Salvage Bans
    Join Date
    Apr 2006
    Posts
    763
    BG Level
    5
    FFXI Server
    Lakshmi

    ...or how very unpleasant? lol jk

    Yeah, RMVX requires a PC... there are some for the PS2 (lol) but they aren't very good.

    And yep, I remember you. I didn't talk to you much... 'cause I didn't really talk much at all, really lol

    When I have a good chunk of game play done for the 2nd one, I'll send you a download link. But it would be better if you have played/beaten the first one before that... I'll just muster up the courage and get the first one ready again for download lol

  18. #18
    BG Content
    Join Date
    Jul 2007
    Posts
    22,360
    BG Level
    10
    FFXI Server
    Lakshmi
    Blog Entries
    1

    Quote Originally Posted by Datonare View Post
    ...or how very unpleasant? lol jk

    Yeah, RMVX requires a PC... there are some for the PS2 (lol) but they aren't very good.

    And yep, I remember you. I didn't talk to you much... 'cause I didn't really talk much at all, really lol

    When I have a good chunk of game play done for the 2nd one, I'll send you a download link. But it would be better if you have played/beaten the first one before that... I'll just muster up the courage and get the first one ready again for download lol
    lol, okay =p I'm meeting with an IT guy today to get my computer proposal approved, then it works its way through a bunch of bureaucratic bullshittery and eventually the department purchases the computer, does some more internal stuff, and gives it to me. If everything goes well, I'll have it by the end of next week.

  19. #19
    Salvage Bans
    Join Date
    Apr 2006
    Posts
    763
    BG Level
    5
    FFXI Server
    Lakshmi

    Awesome, that gives me plenty of time to get more done. Just shoot me a PM when you got your PC ready to go and I can send you over the d/l links.

Similar Threads

  1. Simple calculus problem, and how to fix my TI-89
    By Pirian in forum General Discussion
    Replies: 15
    Last Post: 2011-09-08, 22:27
  2. Math Problem
    By Mojo in forum General Discussion
    Replies: 18
    Last Post: 2010-04-21, 21:14
  3. Math problem driving me bonkers
    By Zieara in forum General Discussion
    Replies: 14
    Last Post: 2010-01-19, 19:57
  4. Another math problem! (Not HW)
    By Julian in forum General Discussion
    Replies: 184
    Last Post: 2009-11-12, 17:33
  5. macroecon. problem (simple)
    By onestopshopcheappills in forum General Discussion
    Replies: 1
    Last Post: 2009-09-29, 20:41
  6. Math Problem (Calculus)
    By dekamii in forum General Discussion
    Replies: 54
    Last Post: 2009-07-30, 17:45
  7. Really quick, simple math help needed >_>
    By ertyu in forum General Discussion
    Replies: 7
    Last Post: 2009-04-14, 01:45
  8. "Simple" Math Problem
    By Wulfgang in forum General Discussion
    Replies: 64
    Last Post: 2008-09-25, 16:19