# Again in english: Problem with probability formula for gaming logic

Discussion in 'C++' started by Andreas Schmitt, Aug 4, 2005.

1. ### Andreas SchmittGuest

Hi,

Sorry for posting in German before, totally forgot about that when I was
pasting this in here from another German newsgroup I was writing to, trying
to get help

I am programming a simple version of a soccer simulation
The logic works like this so far:

[GPG] = constant value goals/game

every minute the chance for a goal is [GPG]/90.
That goals is shot with probability X by Team1, with (1-X) by Team2.

Right now X is set at 50%

I'd like to build in a teamstrength formula now.

I have a few ideas how to do so already, but I'd like to check some
probabilities mathematically first but
I am afraid my maths in that area isn't good enough really.

Maybe someone can help me and write up a formula for me and maybe even
explain it a bit:

On the basis of the system descibed above, GPG/90 probability for a goal per
minute with X% to Team 1 with 1-X% to team 2 - with what probability wins
team1, what probability for a draw and what probability for team2 winning.
I need a formula for that which depends on GPG and X

A first try that I made to approach this problem seems to be faulty
somewhere:

Probability for Team1 winning while shooting exactly 2 goals:

X = probability for Goal by Team1 per minute (here 2,855/90 * 50% = 0,01585)
Y = probability for no goal per minute (here 1-(X+Z) = 0,9682778)
Z = probability for Goal by Team2 per minute (hier 2,855/90 * (100%-50%) =
0,01585)

In 2 of 90 minutes Team1 must shoot a goal

=> X^2

In 87 of 90 minutes no goal must be shot, because either Team1 will have
more than 2 goals or doesn't win

=> Y^87

In the remaining 1 minute can either fall no goal or one for team 2 as long
as the goal count of 2 for team1 doesn't change by them shooting one

=> (Z+Y)^1

Probability total = X^2 * Y^87 * (Z+Y)^1

That seems so be wrong though since the value makes no sense.

Any help is apprechiated and if possible please not just hints but the full
formula. This is not for a test or something if you
might think that, it's not even for the game itself, it's just something
that would really help me trying to balance the logic of the game by
calculating a few possible ways of programming it before implementing them.

Thanks
Andreas Schmitt, Aug 4, 2005

2. ### Victor BazarovGuest

Re: Again in english: Problem with probability formula for gaminglogic

Andreas Schmitt wrote:
> Sorry for posting in German before, totally forgot about that when I was
> pasting this in here from another German newsgroup I was writing to, trying
> to get help
>
> I am programming a simple version of a soccer simulation
> The logic works like this so far:
>
> [GPG] = constant value goals/game
>
> every minute the chance for a goal is [GPG]/90.
> That goals is shot with probability X by Team1, with (1-X) by Team2.
>
> Right now X is set at 50%
>
> I'd like to build in a teamstrength formula now.
>
> I have a few ideas how to do so already, but I'd like to check some
> probabilities mathematically first but
> I am afraid my maths in that area isn't good enough really.
> [..]

Sorry, Andreas, but what does it all have to do with the Standard C++
language, the subject of this newsgroup? If you need help with figuring
out probability, post to a mathematics newsgroup (sci.math.*), if you need
a general algorithm help, comp.programming should be your choice. Only if
you have a C++ _language_ question should you post here, please.

V
Victor Bazarov, Aug 4, 2005

3. ### Tobias BlomkvistGuest

Re: Again in english: Problem with probability formula for gaminglogic

> Probability total = X^2 * Y^87 * (Z+Y)^1
>
> That seems so be wrong though since the value makes no sense.
>
> Any help is apprechiated and if possible please not just hints but the full
> formula. This is not for a test or something if you
> might think that, it's not even for the game itself, it's just something
> that would really help me trying to balance the logic of the game by
> calculating a few possible ways of programming it before implementing them.
>
> Thanks
>
>

Maybe comp.games.development.programming.algorithms is a more
suitable newsgroup. Or a general math-newsgroup.

Tobias
--
IMPORTANT: The contents of this email and attachments are confidential
and may be subject to legal privilege and/or protected by copyright.
Copying or communicating any part of it to others is prohibited and may
be unlawful.
Tobias Blomkvist, Aug 4, 2005