The three TennisGame implementations use hardcoded Strings "player1" and "player2" to check which player is playing.
This means that those classes only give the correct results if the player names happen to be "player1" and "player2" - which they are in the tests but I believe it is not the intention that only those names should give the correct results.
This change is to make those implementations use the player names which the TennisGame was created with, so they work correctly with any player names.
The test has been updated to introduce randomness in the player names in order to show that the scoring works correctly regardless of the names. The randomness does not introduce any non-determinism.
This is for the Scala code only.
The three TennisGame implementations use hardcoded Strings "player1" and "player2" to check which player is playing. This means that those classes only give the correct results if the player names happen to be "player1" and "player2" - which they are in the tests but I believe it is not the intention that only those names should give the correct results.
This change is to make those implementations use the player names which the TennisGame was created with, so they work correctly with any player names.
The test has been updated to introduce randomness in the player names in order to show that the scoring works correctly regardless of the names. The randomness does not introduce any non-determinism.