# Mathematical formula to get how broad opening repertoire is

programmers and mathematicians!

I'm looking for some opinions how to build meaningfull formula that represents broadness of opponent's repertoire.

At the moment I do it like this:

1. I filter all positions that player played at least 2 times. This count = N.
2. By Monte Carlo I evaluate average "broadness" of Mr. Average (using book informations about move probabilities) for N occurrences in his games.
3. I evaluate the same "broadness" for our target player.

This broadness I calculate with "pythagoras thesis" sqrt(m1^2+m2^2+m3^2+m4^2 + ... + mn^2)/N where m1 is number of occurrences of move 1, m2 occurrence of move 2 in that position and sum(m1...mx)=N

So if in 20 games you play 20 times 1.e4, you get sqrt(20^2)/20=1 which means the extreme when repertoire is just as narrow as possible.

When you play 10x 1.e4, 8x 1.d4 1x 1.c4 and 1x 1.Nf3, you get sqrt(10^2+8^2+1^2+1^2)/20=0.64420493633

And when you are on the other side of extreme and make 20x different move in starting position, you get sqrt(20)/20=0.22360679775.

Now I can sum broadness of Mr. Average to find the optimum. I can do the same to the target player and find how the numbers compare to the strategy that I call optimal (playing book moves as Mr. Average). I can weight position broadnesses by any f(N). I can divide player/mr. Average at every position or I can divide sums of these values, there is milions of approaches that can be used but none of them seems easy and logical at the same time.

I'm not concerned here about using correct moves, as I deal with them in other formula. So if it is 10x a4, 8xNh3 etc, I don't mind having same number here like for 10x e4, 8x d4...

With my approach it is possible to see difference between players playing always the same positions compared to coffeehouse masters just picking the line randomly, but still

1. I don't see much logic in my calculation in the first place.
2. The numbers aren't distribured very nicely
3. With changing amount of games/positions same number might have different meaning.
4. I worry there can be problem that the final result can be created by one huge number making the rest of calculation irrelevant.

The only thing I really like here is comparing to Mr. Average, as I don't want to blame players not to be creative in positions where only one move is serious.

If you have some ideas, link to mathematics page dealing with similar problem, anything, I will be happy to think about it!