Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

probability/statistics

Name: Anonymous 2007-09-27 14:46 ID:McCKrQKB

Hope someone can help me with this:

You have a known X-amount of ships. Each ship has known Y-percentage chance of success. Z is a known variable (random number between 0 and X). T is the unknown number of ships that succeed.

Can anyone suggest some sort of equation/formula (can't remember if there's a difference), for T, given that X, Y and Z are known? It's doing my head in.

Name: Anonymous 2007-09-27 17:28 ID:eAD4y07k

It's called 'Binomial distribution'. Look it up. Also, WTF does Z do?

Name: Anonymous 2007-09-27 17:38 ID:McCKrQKB

It's for a game I'm trying to make, but instead of generating 100 random numbers and counting up which ones are above Y, I just want to generate a single value (Z) as a total success.

Thanks for answering too.

Name: Anonymous 2007-09-27 18:08 ID:9igHQRLW

Isn't T the number of ships that succeed? But Z is too? Wha?
If the number of ships is large, (Y/100)*X will tend towards T anyway, but that's not really using random variation properly =3

Name: Anonymous 2007-09-27 18:08 ID:foni2Hlv

TI calculators do it with randBin(100,Y/100) which equals your T which I think is also your Z.

Name: OP 2007-09-27 18:28 ID:McCKrQKB

Okay, erm, I don't think Z is equal to T.

I'm thinking of Z like a random number (no Z-axis involved in this) along the X-axis of a graph, and T is the corresponding Y-axis. and Y is (not the Y-axis, a different Y) the probability (defining the shape of the line).

I think I should of probably picked better variable names.

Name: Anonymous 2007-09-27 18:56 ID:9igHQRLW

What exactly is it that you're trying to achieve though? A pretty graph, or some sort of function call to get a return value T ships succeeding of X trying?
It seems like you're trying to get a probability distribution with neither data nor a formula, which isn't going to get you anywhere. For a game you're going to need to decide, for example, what the standard deviation is if you're running normally distributed data.
Or you just fit some sort of mechanism to determine how many ships succeed given an estimated probability of success Y per ship.

Or you just fit some sort of mechanism to determine how many ships succeed given an estimated probability of success Y per ship. Haxxy, but computationally effective.

Name: OP 2007-09-27 19:08 ID:McCKrQKB

I'll give you an example:

We start with 100 ships (this is X).
Each of these ships has 50% chance to destroy an enemy ship("succeed", this is Y).
Use this to somehow make a curve or line or something equation, with the Y-axis representing 0 (all ships fail) to 100 (all ships suceed). Since it's 50% chance, there's a bias towards the 50% success (or am I assuming wrong?)

Since we're dealing with a game of chance, we don't just do it statistically perfect (i.e. it's not just 50 ships succeed, 50 fail). So we generate a random number, run it (as an X-axis value) through whatever formula defines the line, and hopefully get out the number of ships which succeed (this final number is T, graph-wise the Y-axis I think?).

Name: Anonymous 2007-09-27 19:40 ID:9igHQRLW

In real life there'd be a lot of factors to skew the data around, changing the shape even though 50% would be the average. You'd eventually get a 50/50 split if you performed the test an infinite number of times.
To make things simple, let's consider a normal distribution, which is a nice bell-curve with a peak over 50% success (success for the while fleet of X ships). Since you want to simulate random variation, we're going to need a random variable generator. I don't know what you're making this game in, but chances are the random value you get will be linearly distributed across whatver range you set (0 to 1 is pretty standard, but it doesn't matter), as opposed to already being set to fit a bell curve.
There are probably a ton of methods to fit uniform random numbers to a normal distribution, with all sorts of variable transforms and such, but you're probably best suited with something like the Box-Muller or the tasty Ziggurat algorithm.
Not only does the Ziggurat sound awesome, and remind me of Quake, but it's well suited for computers. All it does is generate a random 2D co-ordinate, like (0 to number of ships, 0 to 100% success), and then it checks to see whether that value falls under the right curve, rejecting the value and trying again if it doesn't fit. If you set the curve to fit a normal distribution, that's what you'll end up with for your results.

Name: Anonymous 2007-09-27 20:10 ID:3uw1zEUQ

get the average of Y

T = YX

Z does a little dance.

done.

Name: Anonymous 2007-09-27 20:11 ID:3uw1zEUQ

Also, are they starships or marine vessels.  Because the former is weak.  Srysly dude, there's a 1000 games like that already.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List