Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Algorithm Help

by tilly (Archbishop)
on Jan 19, 2010 at 04:44 UTC ( #818100=note: print w/replies, xml ) Need Help??

in reply to Algorithm Help

Here are two possible ideas for a solution.

The first is that rather than target a "weight range", have some tunable parameters that are correlated with the likely weight of the result. Then insert values for those parameters, and pick your combination of items, pluses, etc.

The second is to go through an iterative generative process. Make it look like this. On each iteration you randomly pick a trait to modify out of (prefix, prefix2, plus, weapon_type, suffix). If you pick a prefix2 and you have one, you randomly decide whether to regenerate the existing or generate a new one. (If you have 2 already you repeat this decision making process with the third.) Then you make a random choice of that component. (For a prefix2 make a valid choice be "none".) If adding (replacing if need be) that characteristic makes your weapon closer to the target weight, do so.

Continue this process until the target weight is reached, or until a fixed number of rounds has passed.

In essence this is a genetic algorithm, where you're trying to evolve a random weapon that fits your target weight.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://818100]
[marto]: nah, it's not off screen
[Corion]: Somehow I'm happy that my Javascript mostly targets Firefox nowadays :)
[Corion]: But my conundrum currently is how to do lightweight SQL for maintaining my user database, instead of home-cooking too much of an ORM ;)
[Corion]: But maybe Just Enough of an ORM might be the ticket, that is, just locked hashes read from the DB :)

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2018-03-21 12:05 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (267 votes). Check out past polls.