Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
In a game you can have many progress bars: health, mana, spells, etc that use attribute points. I want to create a script that helps you determine the easiest way to level off each of them to purchase another object.
For example
We have three things to note: the identifier, the total on hand (first number) and the amount they earn per hour. Using the above sample, to buy our new spell we'd..HP: 60, 12 per hour Mana: 80, 17 per hour Spells: 31, 7 per hour NEW SPELL: requires 51 HP, 107 mana, 38 spells
We'd need to add to both mana and spells from any surplus we have (which we have 9 extra from HP we don't need). Unfortunately we don't have enough extra to bring all of them to the min. required to buy the new spell so I want the script to then be smart and determine how to shuffle all of our points where we can meet the requirement FASTEST by taking the total we have now and taking how many we earn per hour into consideration.HP: 60 OH, 51 needed, 0 change Mana: 80 OH, 107 needed, +27 change Spells: 31 OH, 38 needed, +7 change
In short, I'm trying to shuffle everything to determine 1) Do we already meet the requirement 2) Can we shuffle them where they'll all meet it, and how 3) If we don't have enough, determine how to shuffle the points in such a way where we'd earn the rest fasted (by the amount earned per hour).
I know I won't get a full solution here but if people can help get me started I'd be very grateful.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Calculate easiest way to 'level results'
by Roy Johnson (Monsignor) on Sep 19, 2007 at 16:36 UTC | |
by ikegami (Patriarch) on Sep 19, 2007 at 17:26 UTC | |
by Roy Johnson (Monsignor) on Sep 19, 2007 at 17:51 UTC | |
|
Re: Calculate easiest way to 'level results'
by ikegami (Patriarch) on Sep 19, 2007 at 17:17 UTC | |
|
Re: Calculate easiest way to 'level results'
by Scott7477 (Chaplain) on Sep 19, 2007 at 17:11 UTC | |
|
Re: Calculate easiest way to 'level results'
by ikegami (Patriarch) on Sep 19, 2007 at 16:15 UTC | |
by Anonymous Monk on Sep 19, 2007 at 16:19 UTC | |
|
Re: Calculate easiest way to 'level results'
by fenLisesi (Priest) on Sep 20, 2007 at 15:41 UTC |