xisto Community

A Good Logical Question.... Yep, its me.... Again ;)

Recommended Posts

Again I've faced up with a problem... I'm writing a simple AI for a bot, but it still works in a slow way :*(

So, the thing I'mma ask you, dear programmers, is that one:

We've got a set of actions that can be done(n).

Each action requires a certain amount of ActionPoints(AP)

Bot has an unknown amount of ap(m)

So, we must find Number of possible combinations, given total number of AP, array of actions and their costs.

As you might understand, I need the formula.

Don't suggest any ways to find the combinations themselves - this is already done by me, that formula would a great deal accelerate the process.

Share on other sites

OK wait, if you have a set number of actions and each action requires a certain amount of AP, but you do not know the amount of AP, then isn't it going to be the same number of possible solutinos every time, which is all of them...Carefully re-word your problem, its hard to understand. Before anyone can devise any type of "formula", you need to make sure you work out the logic first, and make us be able to understand your logic so we can create a "formula"

Edited by BitShift (see edit history)

Share on other sites

Yeah that was really hard to understand. It either sounds like an impossible or a trivial problem.

Share on other sites

Haha thats what I was thinking Hercco, either it sounds insanely simple or near impossible. Either way I'm pretty sure we need a more clear explanation and possibly more information. Maybe provide a small scale example?

Share on other sites

OK, I re-word in a simpler way.Formula gets the data: - Number of AP bot has - Set of actions with cost of each oneAnd gives out the amount of combinations where some of actions ore chosen, but total cost of actions in each combination doesn't exceed total number of AP bot has.

Create an account

Register a new account