- Home /

# Help with maths calculations for basketball sim

Hi everyone, I am not the best maths person going around so I thought I would try here to ask for help! I am trying to work out how to calculate certain things based on stats of the offensive player vs the defensive player but also have some bit of randomness in it. For example: At the moment I am trying to calculate if a pass is successful based on the ints:

how easy the pass is

how good a passer they are

a Random offensive number

Vs the defenders

defensive ability

random number

All these values are out of 10 atm. I cant get the results I am after as I find altering the numbers doesn’t give a radical change in outcome. Does anyone have any ideas? Am I overlooking something obvious?

Thanks for your time! Stay well!

**Answer** by tormentoarmagedoom
·
Mar 24 at 10:47 AM

Hello there!

I recommend you to use percentage to calculate all of this.

I mean, use numbers from 0 to 1 to calculate the final value.

This will make a initial value will decrease every time you apply a property.

```
10 * 0.98 * 0.95 *0.90 = 8.379
```

So a pass initially have 10/10 possiblilities to sucess, you apply the player skill (0.98), the inverse defender skill (0.95) and any other thing (0.90) will result in a pass with 8.379 (meaning 8.379 of every 10 passes will suceed)

This about this, i mean to use numbers from 0 to 1 to decrease the efeectivity of a pass or anything. (you can use numbers from 0.5 to 1.1 so it can even incresae)

Bye!

Thanks for this! I will give it a go after work! I bow to your superior maths mind! :)

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.