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:


I filter all positions that player played at least 2 times. This count = N.
By Monte Carlo I evaluate average "broadness" of Mr. Average  (using book informations about move probabilities) for N occurrences in his games.
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


I don't see much logic in my calculation in the first place.
The numbers aren't distribured very nicely
With changing amount of games/positions same number might have different meaning.
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!
I don't believe your approach works because you're counting every position as an opening repertiore what you're actually measuring is the degree to which they play openings where theory has prescribed a large number of moves.  For example, a Ruy Lopez player might play the first 15 and 20 moves to reach the end of book play.  In contrast, someone who plays the Trompowsky or another unusual opening might be out of book after six moves.  Therefore, I would define "opening" differently.  For example, you could use ECO standard positions as a starting point for defining a person's opening.  I believe Eric Schiller also has an list of chess openings.