How to sort a continuously updated (dynamic) object in an array
问题 I am building a classical Nim game. So far, I've done the player part and the game part. Now, I am trying to sort(rank) the object in an array. I've built the following for sorting: playerList winRatio , which is set in the NimPlayer class with its getter. The aim : to sort the winRatio descendingly, which means from the highest score to the lowest one. The ratio is calculated by score/gamePlayed . If there's a tie, sort using userName alphabetically. I've referred to this issue: How to sort