In this game you are competing against two other people to guess the number that I'm thinking of.
Each person hears the guesses stated by any preceding competitors, so you will be aware of the two prior guesses (provided to you as the vector guessesOfOpponents). Moreover, each guess must be unique.
If everyone guessed randomly, each person should have an equal chance of winning.
It might seem that you're at a disadvantage, having the last opportunity to guess. But actually you have the advantage of extra knowledge.
By guessing strategically, you should be able to achieve a success rate of 45% or more, in which
success rate = (wins + draws/2) / games