The wealth system in d20 Modern always gives me a slight headache at character creation, because I know there's a better way to buy things, but I don't know exactly how, so I'm coming up with an algorithm to automatically buy things in the correct order to minimize losses, sticking it in a program, and just stop thinking about the whole thing. Help if you can, pls.
[Wealth is your Wealth Bonus, and DC is the Purchase DC of the item on the list. > is greater than, < is less than, >= is greater than or equal to, and <= is less than or equal to]
Wealth is a random value generated at the beginning (let's say 1 to 100), and the list of items purchased can contain up to 25 items of equally random purchase DCs. Just in case that's relevant. In the link above, it mentions things like 1d6 and 2d6. In the format xdy, x= number of dice rolled, and y = number of sides each dice have. So 2d6 would generate a number from 2 to 12. 1d6 would generate one from 1 to 6.
Run the following through all items in the list first, since if the following conditions are met, the item is free, but might not remain free if you lose wealth:
If DC <15 and (Wealth - DC) > 0 Purchase item
Then, determine if there are items on the list that would jump up a tier if you lost 1 wealth (So, if Wealth - DC = -10 or -15) [Don't check for Wealth - DC = 0, because it should have already been bought if it was.]
If there isn't, then purchase an item with DC >=15 and (Wealth - DC) > 0
Repeat that until there are either no more items fitting the conditions, or until you are on the verge of jumping up a tier.
(I haven't figured out how to optimize against tier-jumping. I'm inclined to immediately buy anything that might tip over in to -16 territory, and abandon anything that ends up there. If there are none, then prioritize any in the threat of going over a tier, and abandon any that might go in to the -16+ territory. There's some way to better formulate around these tiers, but it's rather mind-racking, and frustrating that I can't seem to figure it out!.)
Repeat the last process (that I actually outlined), but determining if items would jump up a tier if you lost 2 wealth If there isn't, then purchase an item with DC>=15 and (Wealth - DC) < 0 and (Wealth - DC) > -11 (I have no idea where in the queue I should put this, but I just felt like this would be the lowest priority purchase.)
If an item comes with a restriction of +2 or greater (and you only care about the wealth you have at the end), then, unless the black market adjustment pushes the item over a tier, take the black market because you don't lose as much wealth that way. If it's only +1, then take the license unless you have 9 wealth or less, in which case obey the previous rule on restriction.