[Solved] How do I check multiple probabilities?

  • Ah. That Capx explains a lot. So in the each round there will allways happen one event of the ten possible?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yeah it was a bit hard to explain, what I wanted the code to do.

    Yes there will always happen one of the events, except they all have 0% chance. Than the AI will choose another action to do (this part I still have to implement).

    I currently try to use a function so I don't have to copy this code for each of the actions.

  • Games What you are trying to determine is a Bayes decision tree, assuming that your probabilities are independent, Joannak is right, you should multiple them. You can't have a probability over 100% at anytime, because that would happen all the time. (So, no probabilities like 125%)

    Instead of checking for each probability, build a decision tree that gives you the path for each case. With that, you will be able to determine the probability for each scenario.

    Note that the sum of all the probabilities should be equal to 1 (or 100%).

    A quick google search for Bayes Decision tree should help you to understand the probabilities behind of what you are doing, look for an example with numbers... Once you get the idea of it, you should be able to implement it with a function that generates a result if your probability is between certain values.

    Edit: I didn't notice that the solution was already there. Yes a function will help you avoid that. Anyways, a decision tree always help in this scenario (I like graphics).

  • Joannak Sorry I now understand what you tried to tell me.

    gfigueroa The way I'm handling it right now is working for me, but the Bayes decision tree looks interesting and powerful. I only have to understand it as it looks really complicated. The formulas especially. oO

    If you take a quick look at my .capx, do you think the Bayes decision tree whould give me advantages over the way I'm doing it?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)