Author Topic: Anyone who understands probability....  (Read 8906 times)

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Anyone who understands probability....
« on: 2011-12-23 05:07:35 »
See I understand the basic stuff like, chance of guessing all 52 cards in a deck is 52!

But this problem, I don't quite understand.  Remember the FF7 Wonder Square 3d battler?  Well, it is purely based on luck.  According to sources, the format to win EACH POINT (first to 10) is

round 1, girl :  50% chance of win, 25% loss, 25% tie

round 2, wrestler:  33% for each outcome

round 3, afro:  25% win, 25% tie, 50% loss

round 4, spaceman:  25% win, 75% loss

Now obviously these are based on individual points.  What I need to know is how to calculate the overall chance of winning (you need 10 points to win).  I need detailed explanation of how that works :) 

Also appreciate it if anyone can verify the above via script.  Anyone?   8)




« Last Edit: 2011-12-23 05:12:20 by DLPB »

royalmurder

  • *
  • Posts: 61
    • View Profile
    • Ian Merryweather
Re: Anyone who understands probability....
« Reply #1 on: 2011-12-23 14:04:59 »
I can't verify your script, but the probability I can walk you through.

First off, these are for each point, as you say; you need ten points to win, and there are obviously ten ways to get ten points.
10 - 0, 10 - 1, etc.

I'm assuming here that the ties give neither player a point (it has been a while since I played this battler, so I may be wrong), which makes life easier, I think.
what you have to look at is this:

to get two points, the probability (in the first round) is 0.5 AND 0.5, as you want both points. So, you have half a chance, of half a chance, and we multiply: To get the first two points, your probability is 0.5 * 0.5 = 0.25, or 25%
Doing this 10 times, gives you 0.510, which is 1/1024

(this is only for the 10 - 0 win though). Then you work out the probability of getting ten points, but giving away 1; this would simply be the same result as above, but multiplied by 0.25, so 1/4096. You do this repeatedly, until you have the probabilities for all the wins 10 - 0 through to 10 - 9

Now, you can win with any of these results, so you can win with 10 - 0 OR 10 -1 OR 10 - 2, etc, so you add the probabilities together.
Assuming I've done this right (I may be wrong, it has been a while since I did probabilities), this gives you a probability of winning the first round (without any ties at all) of approximately 2289662/1758462093 or 0.00130208209157
This does seem wrong, though, 'cause that's rather a small chance.... :o

xLostWingx

  • *
  • Posts: 801
  • No Comment
    • View Profile
    • FFVII Lost Wing Mod/Hacks
Re: Anyone who understands probability....
« Reply #2 on: 2011-12-23 16:22:25 »
The overall chance of winning the entire game?

Would it be (.666 * .500 * .333 * .250) = .0277 = 2.77% chance of winning the whole game?

I don't think I can defend this method, but it makes sense to me.

You have 1/4 of 1/3 of 1/2 of 2/3 of a chance to win the whole game = 1/36

If you played the fight game 100 times, then you'd beat the Girl ~66 times.  You'd beat the wrestler ~33 times, you'd beat the Afro ~11 times, and you'd beat the Spaceman ~2-3 times.

Or maybe I have no idea what I'm talking about lol.  I was one of those kids in math class that got the answers correct, but couldn't show any work.  I can't remember a formula more complicated than Length x Width to save my life.

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Anyone who understands probability....
« Reply #3 on: 2011-12-23 19:22:52 »
 I know the answers and they are apparently:

1st ~90%

2nd ~70%

3rd ~15%

4th ~10%

overall chance ~0.945%

Question is, if this is true, how :P  Overall chance is simple... that is just 0.9*0.7*0.15*0.10

Quote
If you played the fight game 100 times, then you'd beat the Girl ~66 times.

Not true.. you might beat her 0, might beat her 100 ;)


Also, I have a feeling this answer depends on knowing all combinations of game.  For example, 1 game may be

0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1  where 1 is win, 0 loss. (9-10)  but another could be

0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 Still 9-10

Quote
to get two points, the probability (in the first round) is 0.5 AND 0.5, as you want both points

Surely it is 0.66 win and 0.33 loss in first round.
« Last Edit: 2011-12-23 19:50:41 by DLPB »

royalmurder

  • *
  • Posts: 61
    • View Profile
    • Ian Merryweather
Re: Anyone who understands probability....
« Reply #4 on: 2011-12-23 19:52:41 »
I hadn't thought that disregarding the ties would change the probability.. as I said, it's been a while X)
I'll step out now though, probability was never my strong point

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Anyone who understands probability....
« Reply #5 on: 2011-12-23 20:15:56 »
This post was a nonsense.  8)
« Last Edit: 2011-12-25 00:29:44 by DLPB »

xLostWingx

  • *
  • Posts: 801
  • No Comment
    • View Profile
    • FFVII Lost Wing Mod/Hacks
Re: Anyone who understands probability....
« Reply #6 on: 2011-12-24 00:56:07 »

Not true.. you might beat her 0, might beat her 100 ;)


Hardy har har  :P

Whether there are 10 rounds or 1,000,000 rounds doesn't the win:loss ratio remain the same?  So why would different combos matter?  There should be an equal chance of 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 or 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 occurring. 

====================

After looking at your latest post, I think I see why it is not so simple.  Hmmm, well good luck.  Why exactly are you interested in figuring this out?

luksy

  • *
  • Posts: 375
    • View Profile
Re: Anyone who understands probability....
« Reply #7 on: 2011-12-24 02:48:19 »
Ok I think I got it at last:

first guy is 0.935234
second is exactly 0.5
third is 0.064766
and last is 0.008903

which means the overall odds of beating a given bout are:

round 1 = 94%
round 2 = 47%
round 3 = 3%
round 4 = 0.0003%, or one in 3700  ;D

http://pastebin.com/AYDJHtb6

not being a mathematician I'm sure there's a proper formula for this, but hey it works.
« Last Edit: 2011-12-24 02:51:03 by luksy »

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Anyone who understands probability....
« Reply #8 on: 2011-12-24 04:02:23 »
Yeah you are right, the other guy has it wrong... that explains why no bugger can win it.  Also explains why I have never beat the 3rd one.

I am guessing they either didn't realise how hard they had made it, or more likely, they are having a laugh at how real fairgrounds rip you off.

Quote
After looking at your latest post, I think I see why it is not so simple.  Hmmm, well good luck.  Why exactly are you interested in figuring this out?

Because to beat someone in 1 round is not same odds as beating them in 10.  If you have a 0.66 chance of beating an opponent in 1 round, you have a much greater chance in 10 :)  Only if individual point odds are 0.5 does the overall rounds not matter.

Also, it was for 2 things, 1. to explain how this all works, 2.  because I was sick of losing to 3rd guy and wondering why the odds werent adding up.
« Last Edit: 2011-12-24 04:09:38 by DLPB »

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Anyone who understands probability....
« Reply #9 on: 2011-12-25 05:36:22 »
Luksy has run through an actual program of the minigame 10,000,000 times and the values above are correct or at least very close.  Basically, due to oversight of some kind, or programmer lack of probability knowledge, the end result is a ~3874 to 1 chance of beating all 4 of the enemies. 
« Last Edit: 2011-12-25 05:44:08 by DLPB »

luksy

  • *
  • Posts: 375
    • View Profile
Re: Anyone who understands probability....
« Reply #10 on: 2011-12-25 05:42:40 »
Experimental vals for 100,000,000 iterations are:

0.934018
0.5
0.065982
0.008376

overall odds:
1 / 3874

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Anyone who understands probability....
« Reply #11 on: 2011-12-25 08:35:54 »
I made a little program too and I got :

0.9339127
0.5
0.06629937
0.00911641

0.0002822341  1 in 3543


I guess variance is to do with how program operates and pure chance.  If anyone understands the quick method of getting these results by 1 formula, let me know :P 



Erzfreund

  • *
  • Posts: 26
    • View Profile
Re: Anyone who understands probability....
« Reply #12 on: 2011-12-28 12:47:50 »
Hi there,

I don’t know if it is quicker, but there is a more accurate method to solve this (without explanation, jump to the code).

The maximal number of steps to win a game is 19 (nine defeats, ten victories). This results in these possible positive outcomes (x = victory, o=defeat):
x x x x x x x x x x
x x x x x x x x x x o
x x x x x x x x x x o o
x x x x x x x x x x o o o

x x x x x x x x x x o o o o o o o o o

Imagine all outcomes in a tree diagram and it is apparent that some leaves don’t count, because a win or lose situation happened before step 19. So it is not possible to use the binomial coefficient of 19 ([x+o]^19) to calculate the number of outcomes. But I found way to calculate the needed coefficients (if no one has ever done it, which I absolutely don’t believe, they should be called wondersquare coefficients :D):

1;
previous number multiplied with a fraction of needed number of wins as numerator and 1 as denominator;
previous number multiplied with a fraction of the previous numerator plus 1 and and the previous denominator plus 1;
previous number multiplied with a fraction of the previous numerator plus 1 and and the previous denominator plus 1;
…;
this is done till the fraction is 2. After that it ends.


Now applying all victory outcomes with the coefficients, where the combination with the least steps are combined with the first coefficient and the combination with the most steps are combined with the last coefficient. The results are summed up.


Oh wow, it’s horrible to read. I think the calculation itself is a lot more self explaining.

Let’s apply it for the first round. Victory = 2/3, Defeat 1/3

Code: [Select]
   
1
1 * 10/1 = 10
10 * 11/2 = 55
55 * 12/3 = 220

5005 * 16/7 = 11440
11440 * 17/8 = 24310
24310 * 18/9 = 48620


1 * (2/3)^10 * (1/3)^0 = 0,0173415299
   10 * (2/3)^10 * (1/3)^1 = 0,0578050997
   55 * (2/3)^10 * (1/3)^2 = 0,1059760162
  220 * (2/3)^10 * (1/3)^3 = 0,1413013549
  715 * (2/3)^10 * (1/3)^4 = 0,1530764678
 2002 * (2/3)^10 * (1/3)^5 = 0,1428713699
 5005 * (2/3)^10 * (1/3)^6 = 0,1190594749
11440 * (2/3)^10 * (1/3)^7 = 0,0907119809
24310 * (2/3)^10 * (1/3)^8 = 0,0642543198
48620 * (2/3)^10 * (1/3)^9 = 0,0428362132

0,0173415299 + 0,0578050997 + 0,1059760162 + 0,1413013549 + 0,1530764678 + 0,1428713699 + 0,1190594749 + 0,0907119809 + 0,0642543198 + 0,0428362132
= 0,9352338272

First round win probability = 0,9352

Forth round. Victory = 1/4, Defeat = 3/4:
Code: [Select]
    1 * (1/4)^10 * (3/4)^0 = 9,5367431640625E-007
   10 * (1/4)^10 * (3/4)^1 = 7,15255737304688E-006
   55 * (1/4)^10 * (3/4)^2 = 2,95042991638184E-005
  220 * (1/4)^10 * (3/4)^3 = 8,85128974914551E-005
  715 * (1/4)^10 * (3/4)^4 = 0,0002157502
 2002 * (1/4)^10 * (3/4)^5 = 0,0004530754
 5005 * (1/4)^10 * (3/4)^6 = 0,0008495164
11440 * (1/4)^10 * (3/4)^7 = 0,0014563138
24310 * (1/4)^10 * (3/4)^8 = 0,0023210001
48620 * (1/4)^10 * (3/4)^9 = 0,0034815001

= 0,0089032793

Forth round win probability = 0,0089


First round = 0,9352338272   
Second round = 0,5   
Third round = 0,0647661728   
Forth round = 0,0089032793

Overall probability = 0,0002696426
1 in 3709
« Last Edit: 2011-12-28 12:49:33 by Erzfreund »

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Anyone who understands probability....
« Reply #13 on: 2011-12-28 19:45:37 »
Aye thanks for that! I got it to 3700 with newer program, however, there is 1 formula that should do all this for us?  :cry:

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Anyone who understands probability....
« Reply #14 on: 2011-12-28 21:20:54 »
And because I am obsessive I have made a little program here where you can choose odds.  I think a correction to this minigame would be to alter the prizes slightly, make beating all 4 be worth 100 GP, and make rounds first to 5 not 10.  This would make overall odds around 300-1.

Program here>
http://dl.dropbox.com/u/36889302/FF7/3d-battler.exe

Erzfreund

  • *
  • Posts: 26
    • View Profile
Re: Anyone who understands probability....
« Reply #15 on: 2011-12-28 22:28:54 »
There is a formula for this specific problem. Or do you need a general approach?


Expected probability of winning =
(1*(2/3)^10*(1/3)^0+10*(2/3)^10*(1/3)^1+55*(2/3)^10*(1/3)^2+220*(2/3)^10*(1/3)^3+715*(2/3)^10*(1/3)^4+2002*(2/3)^10*(1/3)^5+5005*(2/3)^10*(1/3)^6+11440*(2/3)^10*(1/3)^7+24310*(2/3)^10*(1/3)^8+48620*(2/3)^10*(1/3)^9)*(1*(1/2)^10*(1/2)^0+10*(1/2)^10*(1/2)^1+55*(1/2)^10*(1/2)^2+220*(1/2)^10*(1/2)^3+715*(1/2)^10*(1/2)^4+2002*(1/2)^10*(1/2)^5+5005*(1/2)^10*(1/2)^6+11440*(1/2)^10*(1/2)^7+24310*(1/2)^10*(1/2)^8+48620*(1/2)^10*(1/2)^9)*(1*(1/3)^10*(2/3)^0+10*(1/3)^10*(2/3)^1+55*(1/3)^10*(2/3)^2+220*(1/3)^10*(2/3)^3+715*(1/3)^10*(2/3)^4+2002*(1/3)^10*(2/3)^5+5005*(1/3)^10*(2/3)^6+11440*(1/3)^10*(2/3)^7+24310*(1/3)^10*(2/3)^8+48620*(1/3)^10*(2/3)^9)*(1*(1/4)^10*(3/4)^0+10*(1/4)^10*(3/4)^1+55*(1/4)^10*(3/4)^2+220*(1/4)^10*(3/4)^3+715*(1/4)^10*(3/4)^4+2002*(1/4)^10*(3/4)^5+5005*(1/4)^10*(3/4)^6+11440*(1/4)^10*(3/4)^7+24310*(1/4)^10*(3/4)^8+48620*(1/4)^10*(3/4)^9)

DLPB_

  • Banned
  • *
  • Posts: 11006
    • View Profile
Re: Anyone who understands probability....
« Reply #16 on: 2011-12-28 22:38:42 »
There is a much simpler formula than that.  Very likely.  You can simplify that.

Erzfreund

  • *
  • Posts: 26
    • View Profile
Re: Anyone who understands probability....
« Reply #17 on: 2011-12-29 15:50:44 »
It is possible to factor out one thing per round,  but this makes the formula just a bit simpler. I don’t know, I did that and additionally I converted the rest in single fractions (rather silly), but it is still a jungle full of numbers.


=(1024/59049*(1+10/3+55/9+220/27+715/81+2002/243+5005/729+11440/2187+24310/6561+48620/19683))*(1/1024*(1+5+55/4+220/8+715/16+2002/32+5005/64+11440/128+24310/256+48620/512))*(1/59049*(1+20/3+220/9+1760/27+11440/81+64064/243+320320/729+1464320/2187+6223360/6561+24893440/19683))*(1/1048576*(1+30/4+495/16+5940/64+57915/256+486486/1024+3648645/4096+25019280/16384+159497910/65536+956987460/262144))


I did a general solution in Python2 (pretty ugly, I guess):

http://pastebin.com/KWPDJw4V