Score is typically a PlayerState variable.
The logic to select the maximum score is something like this:
Of course you can handle separately if the PlayerArray is empty, you can avoid checking the first element by starting with index 1 ( ForLoop
), etc, I just made it fast so you can understand the logic behind selecting a maximum element from a list.