Skip to content
Little GolemMake your next move.

EWN variance for 50 points matches

Public forum discussion.

#1 · Carroll

18 Nov 2013

@FatPhil, trying here ;)

bc..
import random
import math

ITER=100000
k=s=ss=0
while k

#2 · Carroll

18 Nov 2013

 as textile bc.. not implemented...
import random
import math

ITER=100000
k=s=ss=0
while k

#3 · Carroll

18 Nov 2013

Sorry I can not remove, first faulty post.

For everyone, the question was "what should be the typical difference in scores for a n-points game?".

I wanted to use the famous random walk sqrt(2n/pi), or (n-1)!!/(n-2)!! for small values, but this is without barriers.

Bonus question: from the real differences we see for 50-points EWN, can we say it fits, or does 1st player advantage change it a lot?

#4 · MarleysGhost

18 Nov 2013

I repeated Carroll's calculations a few times. Looks consistent.

Trials=100000 Mean=45.97526 MeanSq=2144.235
Var=30.510498 SD=5.523631

Trials=100000 Mean=46.04819 MeanSq=2150.3774
Var=29.94165 SD=5.4718966

Trials=100000 Mean=46.03247 MeanSq=2149.0925
Var=30.104248 SD=5.486734

#5 · Carroll

18 Nov 2013

How the hell can I put two exclam marks in a row:

(n-1)double-factorial/(n-2)double-factorial...

#7 · Carroll

18 Nov 2013

If the players play 100 games,

is about 7.958923738717876149812705024217046140293154042473332135734787...

#8 · MarleysGhost

18 Nov 2013

However, I don't think the calculations address the question "What should the typical difference in scores for a 50-point game be?". At least not if you're taking the expected difference as 4.00=50-46.00. For that, instead of s+=p1; ss+=p1*p1, you'd want s+=min(p1, p2), ss+=min(p1, p2)*min(p1, p2), right?

Trials=100000 Mean=42.04809 MeanSq=1796.6976
Var=28.65564 SD=5.3530965

Trials=100000 Mean=42.05827 MeanSq=1797.4615
Var=28.563477 SD=5.344481

Trials=100000 Mean=42.0588 MeanSq=1797.5511
Var=28.60852 SD=5.3486934

For evenly-matched opponents, I would expect the difference in scores to be closer to 7.95=50-42.05.

#9 · MarleysGhost

18 Nov 2013

> two exclam marks in a row

Try using HTML escape: !! ==> !!

#10 · Carroll

18 Nov 2013

Yes I agree with your value MarleysGhost (our posts crossed!)

But why not s+=math.fabs(s1-s2) ?

#11 · Carroll

18 Nov 2013

OK yes that's the same as on last line you do 50-Mean...

#12 · MarleysGhost

18 Nov 2013

If 99!! means (99!)!, then 99!!/98!! should be a huge number, not 7.95. I don't get it.

Yes, s+=abs(p1-p2) looks good.

Trials=100000 Mean=7.97356 MeanSq=92.24022
Var=28.662563 SD=5.353743

Trials=100000 Mean=7.97013 MeanSq=92.13587
Var=28.6129 SD=5.3491025

Trials=100000 Mean=7.9426 MeanSq=91.6802
Var=28.595306 SD=5.347458

#16 · Carroll

18 Nov 2013

You should at least read the delicious conclusion:

So, suppose for example you got really interested in the space of null lines in 6d complexified compactified Minkowski spacetime:

o
/
/
o-------x


o

The whole diagram is D4, so its q-polynomial is [8]?! If we remove the dots in our subset we're left with

o

o

o

that is, three copies of A1. I never told you how to calculate the q-polynomial for a diagram with more than one piece, but you just multiply the q-polynomials for the pieces, so you get [2]! x [2]! x [2]! This means the q-polynomial for our space is

[8]?! 11 x 1111 x 111111 x 11111111 / 10001
-------------- = --------------------------------------
[2]! [2]! [2]! 11 x 11 x 11

1111 111111 11111111
= ---- x ------ x --------
11 11 10001

= 101 x 10101 x 1111

= 1020201 x 1111

= 1133443311

You'll notice how all these numbers are palindromic; that comes from Poincare duality. We can read of all sorts of wonderful things from the final answer, as listed above. For example, the Euler characteristic of our space G/P is

1+1+3+3+4+4+3+3+1 = 24

The Dynkin diagram D4 is all about triality and the octonions, which are important in superstring theory. The number 24 plays an important role in bosonic string theory. Does this "coincidence" make anything good happen? I don't know!

That's enough for now... I'll leave off with a quote that reminds me of these weird base q calculations.

"What's one and one and one and one and one and one and one and one and one and one?"

"I don't know", said Alice, "I lost count."

"She can't do addition." - Lewis Carroll, Through the Looking Glass.

#17 · FatPhil

19 Nov 2013

Your choice of indentation's not obvious. Any reason why you want to calculate those last 4 things each and every k iteration, or just burning CPU cycles for the lulz?

I'm prepared to blame the choice of language, Python is terminally braindead.

What you're calculating isn't obvious either. A 50-0 victory and a 50-49 victory are being tallied as exactly the same thing. This is, ..., erm, ..., unexpected.

I'd say that from a human perspective, a loss by 10 and a win by 10 are considered the same margin - namely 10. And a loss by 1 and a win by 1 are also considered the same margin - namely 1. However, the human is a wrong because of the year 0 problem. Assuming equal players, the expectation is to win 49.5 games each, so a 50-49 victory is only actually half a point more in your favour, and 49-50 is only half a point in the opponent's favour. This is good, there are no gaps in the possible values, namely the half-integers from -49.5 and +49.5.

And that I think is the more meaningful metric for the margin in an ewn game.
(Compare GWG, Amazons).

#18 · FatPhil

19 Nov 2013

My sim:

phil@geespaz:tmp$ time python ewn50.pl
Trials=10000  Sum=1223  SumSq=857246
Mean=0.1223  Var=85.70964271  SD=9.25795024343942

real    0m0.587s
user    0m0.578s
sys     0m0.007s

Your sim:

phil@geespaz:tmp$ time python ewn50.py
Trials= 10000 Mean= 45.9554 MeanSq= 2143.3278
Var= 31.42901084 SD= 5.60615829602

real    0m6.266s
user    0m6.247s
sys     0m0.020s

My goodness, fragile to the point of brokenness, and slow too, Python really is selling itself well to me.

#19 · FatPhil

19 Nov 2013

#!/usr/bin/perl -w

my $prob=0.5;
my $trials=10000;
my $height=60;

if(@ARGV && $ARGV[0] =~ m/(0?\.\d+)/) { $prob=$1*1.0; }

my @r=(0)x50;
my @b=(0)x50;
my $max=0;
my ($sum,$sum2)=(0,0);
for(my $t=0; $t<$trials; ++$t) {
        my ($r,$b)=(0,0);
        while($r<50 && $b<50) {
                if(rand() < $prob) { $r++; } else { $b++; }
        }
        my $v=0;
        my $val;
        if($r==50) { $v=++$r[$b]; $val=49.5-$b; } else { $v=++$b[$r]; $val=$r-49.5; }
        if($v>$max) { $max=$v; }
        $sum+=$val; $sum2+=$val*$val;
}

my $scale=int($max/$height);
do {
        for(my $r=0; $r<=49; ++$r) { print($b[$r]>=$height*$scale ? "+" : " "); }
        for(my $b=49; $b>=0; --$b) { print($r[$b]>=$height*$scale ? "-" : " "); }
        print("\n");
} while(--$height>0);
my $mu=$sum/$trials;
my $var=$sum2/$trials - $mu*$mu;
print("Trials=$trials  Sum=$sum  SumSq=$sum2\n");
print("Mean=$mu  Var=$var  SD=", sqrt($var), "\n");

#20 · FatPhil

19 Nov 2013

$ARGV[0] should be $ARGV with array subscript 0.

The "smart"quotes will need de-braindead-ifying too. Apart from that, it looks like it's survived in tact.

#21 · FatPhil

19 Nov 2013

OK, catching up, I see Marley's created, ignoring the .5 shift, a folded (signless) equivalent to my value. I was considering losing by X and winning by X to be different events.

If you give my script a probility as a parameter, you'll see that you get a skewed bell curve from non-0.5 probabilities. In those cases, folding the wins and the losses onto each other doesn't really make much sense.

Oh - for multifactorials, just bother remembering baroque HTML entities - use
an obvious function name instead, e.g. multifact(99,2)/multifact(98,2)<code>. That also has the benefit of making sure that people who are unfamiliar with multifactorials don't get so confused by mis-recognising a rather dumb notation. (I always thought that even something like N!_2 was a better notation for those who demand compactness. I have no idea what went through the mind of whoever coined the double-! notation.)</code>