I have an object called "Player" with properties such as "score", "turns", "name", etc. Based on how many players the user chooses to have, I create an array of players.
As the game is played, I update each player's score. What I need to do is compare the "score" from the current player against all the other players. If it is higher, said player wins. Currently the only way I've been able to do this is to create a temporary array with the score values of all players and reorder the array from highest to lowest. I am then checking to see if the current player's score is the same as the score in the 0 index of my temp array. This can cause potential problems though, as two players COULD have the same score, at which point I have no way of correlating the score in the temp array with the player to whom it belongs to.
Is what I'm currently doing the best possible choice? There has to be a way to optimize this. Thanks for any help!