In a certain tournament a player mist be defeated three times to be eliminated. If 512 contestants enter the tournament what is the greatest number of games that could be played?

Assume that in a game one player wins and the other loses, that is no draws.

At the end of the tournament 511 players have each lost 3 games, and the
winner may have lost 0, 1 or 2 games. As each, and every game had a loser
then there were 3*511, 3*511+1 or 3*511+2 games, the largest of these is
3*511+2=3*512-1.