Ahh of course! I had the thought to take this into account but couldn't wrap my head around the math last night.
cA/p is just the time it would take to earn the money to buy A at the current production level - seems much simpler now.
I think the last term should be `cA/(p+pB)`. When I solve from there[1] I get `cB * pB < cA * pA`, which means that the most optimal item A will have the largest product `cA * pA`.
This would translate to:
res.score = res.cost*res.powerGain
...
}).sort(function(a,b){return b.score - a.score})
Does that check out? It seems too simple, and now that I'm thinking more about it I think this would be functionally equal to what I already have. Did I do my inequality[1] wrong?
1. http://i.imgur.com/pyMY3zr.jpg