1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Rep Power

    Picking the optimum game stats


    I am new to programing and currently teaching myself python.
    I am playing a game and would like to use python to help me pick the best possible stats from the items I have.

    Let me try and explain. In the game you can equip your character with 7 different items each item give a boost to your stats. Some items give positive number some negative and some a mixture of both. There are 4 different stats like strength, defense, critical and agility. So one item for example armor can give you + 100 strength, +35 in agility and - (minus) 75 in defense. Another item say shoes give you different stats. It can be only one stat change like + 300 in critical.

    What I would like if possible is a way to enter all items and their stats that I have collected and have an answer on the best and highest combination possible.

    Thank you for any advice and suggestion.
  2. #2
  3. Contributing User
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Aug 2011
    Rep Power
    You'd like to find all combinations of items your character can use then choose the one that maximizes some feature? (greatest average, largest minimum, highest agility) In j (www.jsoftware.com) the monadic verb { computes the Cartesian product.
       >L:1{(;:'leatherBoots AchillesHeel');<;:'buckledBelt ChampionsGirdle herniaHalter'
    │leatherBoots│leatherBoots   │leatherBoots│
    │buckledBelt │ChampionsGirdle│herniaHalter│
    │AchillesHeel│AchillesHeel   │AchillesHeel│
    │buckledBelt │ChampionsGirdle│herniaHalter│
    I'd have to consider the problem for "a while" to figure out how to solve this problem in general without writing special code---oh I think I've got it---

    Anyway the most obvious algorithm is to write nested loops.
    for shoe in 'AchillesHeel leatherBoots'.split():
        for belt in 'herniaHalter buckledBelt ChampionsGirdle'.split():
            for ring in 'gold TomMix'.split():
                if better:
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo