Is there a common way for ranking system (4 different ranks) in a smart contract? The ranking of a player depends on his ETH spent. The more ETH spent, the higher the rank. This means a player can downrank at any time (through a purchase of another player). Recalculating after each purchase is too gas intensive I guess. What else can I do to solve this?
My only solution is just changing the rankings of that players, that downranked and upranked. But how shall the players be stored? As map or list? Linked-list does not seem to be correct in here.
EDIT: I think I have mastered it out. Each rank gets a threshold value. If a player makes a transaction and reaches the threshold, he ranks up. Then he has to figure out if some other players have deranked, by just checking the lowest players in each rank. This presupposes: Players must be stored in one rank. There must be 4 ranks (maps) each being a linked list. Why linked lists? because we cannot order the list physically. Then the player starts to check players balance at the bottom of the rank. If that player is still over the threshold, no player has deranked, including the player we have already checked. Otherwise the player above this player has to be checked and so on... Every player that deranks is being deleted in the current rank and being added in a rank below. Then this steps moves on until the last ranks is reached.