I have a problem with a ranking system I am using.

Scenario:

An online game with around 10k players calculates a real time ranking of points when a certain event occurs. Events don't occur that often, around 1 time per minute. This ranking is kept in the cache for quick calculations, sorting and access.

Now players can form groups and play against each other, but the scoring system is the same, only the ranking is based for the players in that group.

At first I created for every group a separate ranking, effectively having the same scores as the complete ranking, but with different positions in the ranking.

This is trivial because there are over 1.000 groups and every time an event occurs all the groups would have to be updated.

So what I did now is when the group ranking is requested take only the players that are in that group from the complete ranking and show them. The positions would have to be re-counted.

That re-counting is where the problem is. Because the sub-list is by-reference from the complete ranking list I cannot change the position of the player in the sub-ranking without updating it in the complete ranking, because it's just a reference.

I came up with two solutions:


Create a copy from the record every time it is requested and do some output caching (not very desirable because the rankings are live)
Create a copy and store this in a cache which is reset when an event occurs.
Create a sub-list with just the positions which is updated when an event occurs.


And the last solution: do the position counting in the output instead in the business side. This would be the best solution, only problem is that on some pages this text appears: "You are on position # in the ranking" where # is your ranking position. This number would be tedious to get then.

Does anybody have any suggestions to this problem?


Question: Lorentz Invariance of Maxwell Equations
Answer: Due to the constraint $\nabla \cdot B =0$, there exists a vector potential $A$ such that $B = \nabla \times A$ and $E_j = \partial_0 A_j - \partial_j A_0$ (up to a sign I forget). In other words, $E$ and $B$ assemble into a "field strength tensor" $F_{\mu \nu} = \partial_\mu A_\nu - \partial_\nu A_\mu = dA_{\mu \nu}$. This is the correct object to reason about when thinking relativistically. It's just a 2-form, so its transformation rules are simple. We can write Maxwell's equations as

$d * F = 0$,

here $*$ is the Hodge star. This is clearly invariant under isometries (Lorentz transformations).